Documentation ¶
Index ¶
- func AppendNotNil[T any](in []*T, values ...*T) (out []*T)
- func Contains[S ~[]E, E comparable](s S, v E) bool
- func Filter[S ~[]V, V any](s S, predicate func(V V) bool) []V
- func FilterNil[T any](in []*T) (out []*T)
- func Flatten[T any](s [][]T) (flattened []T)
- func Flatten3[T any](s [][][]T) (flattened []T)
- func Flatten4[T any](s [][][][]T) (flattened []T)
- func GroupBy[S ~[]V, V any, K comparable](s S, extract func(v V) K) map[K][]V
- func GroupByLen[S ~[]V, V any](input S, length int) (output [][]V)
- func Index[S ~[]E, E comparable](s S, v E) int
- func Intersection[T cmp.Ordered](pS ...[]T) []T
- func Map[S ~[]V, V any, E any](s S, extract func(v V) E) []E
- func MapFrom[S ~[]I, I any, K comparable, V any](s S, extractKey func(i I) K, extractValue func(i I) V) map[K]V
- func NumPages[V any](s []V, pageSize int) int
- func Page[V any](s []V, pageSize int, pageIndex int) []V
- func RemoveNil[T any](in []T) (out []T)
- func SyncMap[S ~[]V, V any, E any](ctx context.Context, s S, ...) (mapped []E, err error)
- func Unique[T comparable](s []T) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendNotNil ¶ added in v0.4.0
func AppendNotNil[T any](in []*T, values ...*T) (out []*T)
func Contains ¶
func Contains[S ~[]E, E comparable](s S, v E) bool
Contains reports whether v is present in s.
func GroupBy ¶
func GroupBy[S ~[]V, V any, K comparable](s S, extract func(v V) K) map[K][]V
func GroupByLen ¶ added in v0.7.0
func Index ¶
func Index[S ~[]E, E comparable](s S, v E) int
Index returns the index of the first occurrence of v in s, or -1 if not present.
func Intersection ¶ added in v0.2.1
func MapFrom ¶
func MapFrom[S ~[]I, I any, K comparable, V any](s S, extractKey func(i I) K, extractValue func(i I) V) map[K]V
func Unique ¶ added in v0.3.0
func Unique[T comparable](s []T) []T
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.