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 FoldKV[M ~map[K]E, K comparable, E any, F any](m M, init F, consume func(k K, e E, acc F) F) F
- func FoldSKV[M ~map[K]E, K cmp.Ordered, E any, F any](m M, init F, consume func(k K, e E, acc F) F) F
- func FoldSKVFunc[M ~map[K]E, K cmp.Ordered, E any, F any](m M, init F, consume func(k K, e E, acc F) F, cmp CompareFunc[K]) F
- func FoldSV[M ~map[K]E, K cmp.Ordered, E any, F any](m M, init F, consume func(e E, acc F) F) F
- func FoldSVFunc[M ~map[K]E, K cmp.Ordered, E any, F any](m M, init F, consume func(e E, acc F) F, cmp CompareFunc[K]) F
- func FoldV[M ~map[K]E, K comparable, E any, F any](m M, init F, consume func(e E, acc F) F) F
- func Keys[M ~map[K]V, K comparable, V any](m M, cmp ...CompareFunc[K]) []K
- func OrderedKeys[M ~map[K]V, K cmp.Ordered, V any](m M) []K
- func OrderedTransformedKeys[M ~map[K]V, K comparable, V any, TK cmp.Ordered](in M, m transformer.Transformer[K, TK]) []TK
- func OrderedTransformedValues[M ~map[K]V, K comparable, V any, TV cmp.Ordered](in M, m transformer.Transformer[V, TV]) []TV
- 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 TransformKeys[M ~map[K]V, K comparable, V any, TK comparable](in M, m transformer.Transformer[K, TK]) map[TK]V
- func TransformValues[M ~map[K]V, K comparable, V any, TV any](in M, m transformer.Transformer[V, TV]) map[K]TV
- func TransformedKeys[M ~map[K]V, K comparable, V any, TK comparable](in M, m transformer.Transformer[K, TK], cmp ...CompareFunc[TK]) []TK
- func TransformedValues[M ~map[K]V, K comparable, V any, TV any](in M, m transformer.Transformer[V, TV], cmp ...CompareFunc[TV]) []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 FoldKV ¶
func FoldKV[M ~map[K]E, K comparable, E any, F any](m M, init F, consume func(k K, e E, acc F) F) F
FoldKV provides an aggregation of all elements of a map using an incremental aggregation function, which combines a slice element and its key with an intermediate aggregation result starting with a given initial value.
func FoldSKV ¶
func FoldSKV[M ~map[K]E, K cmp.Ordered, E any, F any](m M, init F, consume func(k K, e E, acc F) F) F
FoldSKV provides an aggregation of all elements of a map using an incremental aggregation function, which combines a slice element and its key with an intermediate aggregation result starting with a given initial value. The entry order is determined by the ordered key values.
func FoldSKVFunc ¶
func FoldSKVFunc[M ~map[K]E, K cmp.Ordered, E any, F any](m M, init F, consume func(k K, e E, acc F) F, cmp CompareFunc[K]) F
FoldSKVFunc provides an aggregation of all elements of a map using an incremental aggregation function, which combines a slice element and its key with an intermediate aggregation result starting with a given initial value. The entry order is determined by the sort function on the key values.
func FoldSV ¶
FoldSV provides an aggregation of all elements of a map using an incremental aggregation function, which combines a map element with an intermediate aggregation result starting with a given initial value. The entry order is determined by the ordered values.
func FoldSVFunc ¶
func FoldSVFunc[M ~map[K]E, K cmp.Ordered, E any, F any](m M, init F, consume func(e E, acc F) F, cmp CompareFunc[K]) F
FoldSVFunc provides an aggregation of all elements of a map using an incremental aggregation function, which combines a map element with an intermediate aggregation result starting with a given initial value. The entry order is determined by the sort function on the key values.
func FoldV ¶
func FoldV[M ~map[K]E, K comparable, E any, F any](m M, init F, consume func(e E, acc F) F) F
FoldV provides an aggregation of all elements of a map using an incremental aggregation function, which combines a map element with an intermediate aggregation result starting with a given initial value.
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 OrderedKeys ¶
OrderedKeys provides an ordered key list for maps with an ordered key type.
func OrderedTransformedKeys ¶
func OrderedTransformedKeys[M ~map[K]V, K comparable, V any, TK cmp.Ordered](in M, m transformer.Transformer[K, TK]) []TK
func OrderedTransformedValues ¶
func OrderedTransformedValues[M ~map[K]V, K comparable, V any, TV cmp.Ordered](in M, m transformer.Transformer[V, TV]) []TV
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 TransformKeys ¶
func TransformKeys[M ~map[K]V, K comparable, V any, TK comparable](in M, m transformer.Transformer[K, TK]) map[TK]V
func TransformValues ¶
func TransformValues[M ~map[K]V, K comparable, V any, TV any](in M, m transformer.Transformer[V, TV]) map[K]TV
func TransformedKeys ¶
func TransformedKeys[M ~map[K]V, K comparable, V any, TK comparable](in M, m transformer.Transformer[K, TK], cmp ...CompareFunc[TK]) []TK
func TransformedValues ¶
func TransformedValues[M ~map[K]V, K comparable, V any, TV any](in M, m transformer.Transformer[V, TV], cmp ...CompareFunc[TV]) []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]