Documentation ¶
Index ¶
- func All[S ~[]T, T any, F func(T) bool](inp S, pred F) bool
- func Any[S ~[]T, T any, F func(T) bool](inp S, pred F) bool
- func CastSlice[T any, I ~[]any](sl I) ([]T, error)
- func Chunk[S ~[]T, T any](sl S, size int) [][]T
- func Contains[T any](in []T, elem T) bool
- func ContainsAll[T any](in []T, elements []T) bool
- func ContainsFunc[S ~[]T, T any](sl S, pred func(T) bool) bool
- func Difference[S ~[]T, T comparable](left, right S) (inLeft, inRight []T)
- func DifferenceKeyed[S1 ~[]T1, S2 ~[]T2, T1, T2 mdl.Keyed](left S1, right S2) (inLeft S1, inRight S2)
- func DifferenceMaps[K comparable, V1, V2 any, M1 ~map[K]V1, M2 ~map[K]V2](left M1, right M2) (inLeft M1, inRight M2)
- func Empty[S ~[]T, T any](inp S) bool
- func Filter[S ~[]T, T any](sl S, pred func(T) bool) []T
- func FindFirst[S ~[]T, T comparable](sl S, el T) (out T, ok bool)
- func FindFirstFunc[S ~[]T, T any](sl S, pred func(T) bool) (out T, ok bool)
- func First[S ~[]T, T any](sl S) (out T, ok bool)
- func Flatten[S ~[]T, T any](sl []S) []T
- func Index[T any](sl []T, e T) int
- func Intersect[S ~[]T, T comparable](sl1, sl2 S) []T
- func IntersectKeyed[S ~[]T, T mdl.Keyed](s1, s2 S) S
- func IntersectMaps[K comparable, V any, M ~map[K]V](m1, m2 M) M
- func KeyedToMap[S ~[]T, T mdl.Keyed](sl S) map[string]T
- func Last[T any](sl []T) T
- func Map[S ~[]T1, T1, T2 any, F func(T1) T2](sl S, op F) []T2
- func MapKeys[K1 comparable, K2 comparable, V any, M1 ~map[K1]V](m M1, f func(key K1) K2) map[K2]V
- func MapValues[K comparable, V1, V2 any, M1 ~map[K]V1](m M1, f func(value V1) V2) map[K]V2
- func MergeMaps[K comparable, V any, M ~map[K]V](m ...M) M
- func None[S ~[]T, T any, F func(T) bool](inp S, pred F) bool
- func NotEmpty[S ~[]T, T any](inp S) bool
- func Partition[S ~[]T, T any, E comparable, F func(T) E](sl S, keyer F) map[E][]T
- func PartitionMap[S ~[]T, T, K comparable, V any, F func(T) (K, V)](inp S, keyer F) map[K][]V
- func Reduce[S ~[]T1, T1, T2 any](sl S, op func(T2, T1, int) T2, init T2) T2
- func Repeat[T any](el T, times int) []T
- func Reverse[S ~[]T, T any](sl S) S
- func SetToSlice[T comparable](s Set[T]) []T
- func SliceToMap[S ~[]T, T, V any, K comparable](sl S, keyer func(T) (K, V)) map[K]V
- func Tail[T any](sl []T) []T
- func Uniq[S ~[]T, T comparable](sl S) S
- func UniqByType[S ~[]T, T any](sl S) S
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CastSlice ¶
CastSlice casts a []any slice to the given type. The parameter sliceType is required to correctly infer the target type.
func ContainsAll ¶ added in v0.21.5
func ContainsFunc ¶
func Difference ¶
func Difference[S ~[]T, T comparable](left, right S) (inLeft, inRight []T)
func DifferenceKeyed ¶
func DifferenceMaps ¶
func DifferenceMaps[K comparable, V1, V2 any, M1 ~map[K]V1, M2 ~map[K]V2](left M1, right M2) (inLeft M1, inRight M2)
func FindFirst ¶
func FindFirst[S ~[]T, T comparable](sl S, el T) (out T, ok bool)
func FindFirstFunc ¶
func Intersect ¶
func Intersect[S ~[]T, T comparable](sl1, sl2 S) []T
func IntersectKeyed ¶
func IntersectMaps ¶
func IntersectMaps[K comparable, V any, M ~map[K]V](m1, m2 M) M
func KeyedToMap ¶
func MapKeys ¶
func MapKeys[K1 comparable, K2 comparable, V any, M1 ~map[K1]V](m M1, f func(key K1) K2) map[K2]V
func MapValues ¶
func MapValues[K comparable, V1, V2 any, M1 ~map[K]V1](m M1, f func(value V1) V2) map[K]V2
func MergeMaps ¶
func MergeMaps[K comparable, V any, M ~map[K]V](m ...M) M
func Partition ¶
func Partition[S ~[]T, T any, E comparable, F func(T) E](sl S, keyer F) map[E][]T
func PartitionMap ¶ added in v0.8.3
func PartitionMap[S ~[]T, T, K comparable, V any, F func(T) (K, V)](inp S, keyer F) map[K][]V
func SetToSlice ¶
func SetToSlice[T comparable](s Set[T]) []T
func SliceToMap ¶
func SliceToMap[S ~[]T, T, V any, K comparable](sl S, keyer func(T) (K, V)) map[K]V
func Uniq ¶
func Uniq[S ~[]T, T comparable](sl S) S
func UniqByType ¶
func UniqByType[S ~[]T, T any](sl S) S
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
func SliceToSet ¶
func SliceToSet[S ~[]T, T comparable](sl S) Set[T]
Click to show internal directories.
Click to hide internal directories.