Documentation
¶
Index ¶
- func AddOrUpdateSlice[T any](slice []T, items ...T) []T
- func Chunk[T any](slice []T, size int) [][]T
- func Contains[T comparable](slice []T, item T) bool
- func Filter[T any](objs []T, filter func(obj T) bool) []T
- func FilterMap[K comparable, V any](m map[K]V, f func(K, V) bool) map[K]V
- func First[T any](objs []T) (T, bool)
- func GetDefault[T any](s, d T) T
- func IsZero[T any](v T) bool
- func IteratePartitions[T comparable](devices []T, size int, callback func([][]T))
- func IterateSets[T any](devices []T, size int, callback func([]T))
- func Map[T any, K any](objs []T, mapper func(obj T) ([]K, bool)) []K
- func Max[T cmp.Ordered](ts ...T) T
- func Min[T cmp.Ordered](ts ...T) T
- func NoSpace(s string) bool
- func OR[T any](vs ...T) T
- func Range[T any](objs []T, fn func(obj T) bool)
- func Reverse[T any](slice []T) []T
- func SetContains[T comparable](set []T, d T) bool
- func SetCopyAndAddPadding[T comparable](set []T, size int) []T
- func SetCountPadding[T comparable](set []T) int
- func Sum[T cmp.Ordered](ts ...T) T
- func Unique[T comparable](slice []T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOrUpdateSlice ¶
func AddOrUpdateSlice[T any](slice []T, items ...T) []T
AddOrUpdateSlice 添加或更新切片中的元素
func Contains ¶ added in v1.5.0
func Contains[T comparable](slice []T, item T) bool
Contains 检查切片是否包含指定元素
func FilterMap ¶
func FilterMap[K comparable, V any](m map[K]V, f func(K, V) bool) map[K]V
FilterMap 过滤map
func IteratePartitions ¶
func IteratePartitions[T comparable](devices []T, size int, callback func([][]T))
func IterateSets ¶
func SetContains ¶
func SetContains[T comparable](set []T, d T) bool
func SetCopyAndAddPadding ¶
func SetCopyAndAddPadding[T comparable](set []T, size int) []T
func SetCountPadding ¶
func SetCountPadding[T comparable](set []T) int
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.