Documentation
¶
Index ¶
- func MapContains[K comparable, V any](data map[K]V, key K) bool
- func MapKeys[K comparable, V any](data map[K]V) []K
- func MapOrderedIterator[K Constraints, V any](data map[K]V) func(yield func(K, V) bool)
- func MapPipeline[K comparable, V, T any](data map[K]V, predicate func(K, V) T) map[K]T
- func MapToSlice[K comparable, V, T any](data map[K]V, predicate func(K, V) T) []T
- func MapValueContains[K, V comparable](data map[K]V, value V) bool
- func MapValues[K comparable, V any](data map[K]V) []V
- func SliceDistinct[T comparable](list []T) []T
- func SliceFilter[T any](slice []T, predicate func(*T) bool) []T
- func SliceForeach[T any](slice *[]T, predicate func(*T))
- func SliceOrderAsk[T Constraints](slice *[]T)
- func SliceOrderDesc[T Constraints](slice *[]T)
- func SlicePipeline[T, R any](slice []T, predicate func(*T) R) []R
- func SliceToMap[T any, K comparable, V any](slice *[]T, predicate func(*T) (K, V)) map[K]V
- type Constraints
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapContains ¶
func MapContains[K comparable, V any](data map[K]V, key K) bool
MapContains checks if the provided map contains the specified key.
func MapKeys ¶
func MapKeys[K comparable, V any](data map[K]V) []K
MapKeys returns a slice of keys from the provided map.
func MapOrderedIterator ¶
func MapOrderedIterator[K Constraints, V any](data map[K]V) func(yield func(K, V) bool)
MapOrderedIterator returns a function that iterates over the provided map in a sorted order.
func MapPipeline ¶ added in v1.1.5
func MapPipeline[K comparable, V, T any](data map[K]V, predicate func(K, V) T) map[K]T
func MapToSlice ¶ added in v1.1.4
func MapToSlice[K comparable, V, T any](data map[K]V, predicate func(K, V) T) []T
func MapValueContains ¶
func MapValueContains[K, V comparable](data map[K]V, value V) bool
MapValueContains checks if the provided map contains the specified value.
func MapValues ¶
func MapValues[K comparable, V any](data map[K]V) []V
MapValues returns a slice of values from the provided map.
func SliceDistinct ¶
func SliceDistinct[T comparable](list []T) []T
SliceDistinct returns a new slice with unique elements from the provided slice.
func SliceFilter ¶
SliceFilter returns a new slice with elements that satisfy the provided predicate function.
func SliceForeach ¶
func SliceForeach[T any](slice *[]T, predicate func(*T))
SliceForeach applies the provided function to each element in the provided slice.
func SliceOrderAsk ¶
func SliceOrderAsk[T Constraints](slice *[]T)
SliceOrderAsk sorts the provided slice in ascending order.
func SliceOrderDesc ¶
func SliceOrderDesc[T Constraints](slice *[]T)
SliceOrderDesc sorts the provided slice in descending order.
func SlicePipeline ¶ added in v1.1.4
func SlicePipeline[T, R any](slice []T, predicate func(*T) R) []R
func SliceToMap ¶
func SliceToMap[T any, K comparable, V any](slice *[]T, predicate func(*T) (K, V)) map[K]V
SliceToMap converts the provided slice to a map using the provided predicate function.