Documentation ¶
Index ¶
- func FilterByKey[M ~map[K]V, K comparable, V any](m M, matcher matcher.Matcher[K]) M
- func FilterByValue[M ~map[K]V, K comparable, V any](m M, matcher matcher.Matcher[V]) M
- func FilterKeys[M ~map[K]V, K comparable, V any](m M, matcher matcher.Matcher[K]) []V
- func FilterValues[M ~map[K]V, K comparable, V any](m M, matcher matcher.Matcher[V]) []V
- func Keys[M ~map[K]V, K comparable, V any](m M, cmp ...CompareFunc[K]) []K
- func MapKeys[M ~map[K]V, K comparable, V any, TK comparable](in M, m transformer.Transformer[K, TK]) map[TK]V
- func OrderedKeys[M ~map[K]V, K cmp.Ordered, V any](m M) []K
- func OrderedValues[M ~map[K]V, K cmp.Ordered, V any](m M) []V
- func Transform[M ~map[K]V, K comparable, V any, TK comparable, TV any](in M, m Transformer[K, V, TK, TV]) map[TK]TV
- func TransformValues[M ~map[K]V, K comparable, V any, TV comparable](in M, m transformer.Transformer[V, TV]) map[K]TV
- func Values[M ~map[K]V, K comparable, V any](m M, cmp ...CompareFunc[K]) []V
- type CompareFunc
- type Transformer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterByKey ¶
func FilterByKey[M ~map[K]V, K comparable, V any](m M, matcher matcher.Matcher[K]) M
func FilterByValue ¶
func FilterByValue[M ~map[K]V, K comparable, V any](m M, matcher matcher.Matcher[V]) M
func FilterKeys ¶
func FilterKeys[M ~map[K]V, K comparable, V any](m M, matcher matcher.Matcher[K]) []V
func FilterValues ¶
func FilterValues[M ~map[K]V, K comparable, V any](m M, matcher matcher.Matcher[V]) []V
func Keys ¶
func Keys[M ~map[K]V, K comparable, V any](m M, cmp ...CompareFunc[K]) []K
Keys provides a list of keys optionally sorted by a CompareFunc.
func MapKeys ¶
func MapKeys[M ~map[K]V, K comparable, V any, TK comparable](in M, m transformer.Transformer[K, TK]) map[TK]V
func OrderedKeys ¶
OrderedKeys provides an ordered key list for maps with an ordered key type.
func OrderedValues ¶
OrderedValues returns values optionally ordered by ordered keys.
func Transform ¶
func Transform[M ~map[K]V, K comparable, V any, TK comparable, TV any](in M, m Transformer[K, V, TK, TV]) map[TK]TV
func TransformValues ¶
func TransformValues[M ~map[K]V, K comparable, V any, TV comparable](in M, m transformer.Transformer[V, TV]) map[K]TV
func Values ¶
func Values[M ~map[K]V, K comparable, V any](m M, cmp ...CompareFunc[K]) []V
Values returns values optionally ordered by keys.
Types ¶
type CompareFunc ¶
type Transformer ¶
type Transformer[K, V, TK, TV any] func(K, V) (TK, TV)
func KeyValueTransformer ¶
func KeyValueTransformer[K, V, TK, TV any](tk transformer.Transformer[K, TK], tv transformer.Transformer[V, TV]) Transformer[K, V, TK, TV]
Click to show internal directories.
Click to hide internal directories.