Documentation
¶
Index ¶
- func Filter[T any](slice []T, predicate func(T) bool) []T
- func FirstMatch[T any](slice []T, predicate func(T) bool) (T, bool)
- func GroupBy[T any, K comparable](slice []T, keyFunc func(T) K) map[K][]T
- func Keys[T any, K comparable](m map[K]T) []K
- func Map[T any, E any](slice []T, mapFunc func(T) E) []E
- func Sample[T any](slice []T, n int) []T
- func ToSet[T comparable](s []T) map[T]bool
- func UniqBy[T any, K comparable](slice []T, keyFunc func(T) K) []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstMatch ¶
func GroupBy ¶
func GroupBy[T any, K comparable](slice []T, keyFunc func(T) K) map[K][]T
func Keys ¶
func Keys[T any, K comparable](m map[K]T) []K
func Sample ¶
Sample randomly selects n elements from a slice. elements selected are unique by index
func ToSet ¶
func ToSet[T comparable](s []T) map[T]bool
func UniqBy ¶ added in v0.1.7
func UniqBy[T any, K comparable](slice []T, keyFunc func(T) K) []T
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.