Documentation
¶
Index ¶
- func Copy[T1 comparable, T2 any](m map[T1]T2) map[T1]T2
- func CountFunc[T1 comparable, T2 any](m map[T1]T2, f func(T2) bool) int
- func Filter[T1 comparable, T2 any](m map[T1]T2, f func(T2) bool) map[T1]T2
- func Keys[T1 comparable, T2 any](m map[T1]T2) []T1
- func MapValues[T1 comparable, T2, T3 any](m map[T1]T2, f func(T2) T3) map[T1]T3
- func Merge[T1 comparable, T2 any](m1, m2 map[T1]T2) map[T1]T2
- func Select[T1 comparable, T2 any](m map[T1]T2, kk []T1) (map[T1]T2, error)
- func Slice[T1 comparable, T2 any](m map[T1]T2) []T2
- func SortedKeys[T1 comparable, T2 any](m map[T1]T2, sort func([]T1)) []T1
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
func Copy[T1 comparable, T2 any](m map[T1]T2) map[T1]T2
Copy returns a shallow copy of the given map.
func CountFunc ¶
func CountFunc[T1 comparable, T2 any](m map[T1]T2, f func(T2) bool) int
CountFunc returns the number of elements in the map that satisfy the predicate f.
func Filter ¶
func Filter[T1 comparable, T2 any](m map[T1]T2, f func(T2) bool) map[T1]T2
Filter returns a shallow copy of the given map with items that satisfy the predicate f.
func Keys ¶
func Keys[T1 comparable, T2 any](m map[T1]T2) []T1
Keys returns the slice of keys for the given map.
func MapValues ¶
func MapValues[T1 comparable, T2, T3 any](m map[T1]T2, f func(T2) T3) map[T1]T3
MapValues returns a new map with the values of the given map transformed by the function f.
func Merge ¶
func Merge[T1 comparable, T2 any](m1, m2 map[T1]T2) map[T1]T2
Merge returns a new map that contains all the elements of the given maps.
func Select ¶
func Select[T1 comparable, T2 any](m map[T1]T2, kk []T1) (map[T1]T2, error)
Select returns a shallow copy of the given map with items that satisfy the predicate f and will fail when key is not present.
func Slice ¶
func Slice[T1 comparable, T2 any](m map[T1]T2) []T2
Slice returns map values as a slice.
func SortedKeys ¶
func SortedKeys[T1 comparable, T2 any](m map[T1]T2, sort func([]T1)) []T1
SortedKeys returns the slice of keys for the given map, sorted using given sorting function.
Types ¶
This section is empty.