Documentation ¶
Index ¶
- func Clone[K comparable, V any](source map[K]V) map[K]V
- func Keys[K comparable, V any](m map[K]V) []K
- func Map[K comparable, V any, W any](m map[K]V, mapper types.Mapper[V, W]) map[K]W
- func MapEntries[K, TK comparable, V, TV any](m map[K]V, mapper func(K, V) (TK, TV)) map[TK]TV
- func MapKeys[K, W comparable, V any](m map[K]V, mapper types.Mapper[K, W]) map[W]V
- func ReduceEntries[Value any, Key comparable, Element any](initialValue Value, elements map[Key]Element, ...) Value
- func ReduceKeys[Value any, Key comparable, Element any](initialValue Value, elements map[Key]Element, reducer func(Value, Key) Value) Value
- func ReduceValues[Value any, Key comparable, Element any](initialValue Value, elements map[Key]Element, ...) Value
- func Values[K comparable, V any](m map[K]V) []V
- type Entry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clone ¶
func Clone[K comparable, V any](source map[K]V) map[K]V
Clone copy a map entries into a new map
func Keys ¶
func Keys[K comparable, V any](m map[K]V) []K
func Map ¶ added in v0.4.0
func Map[K comparable, V any, W any](m map[K]V, mapper types.Mapper[V, W]) map[K]W
Map maps values. Returns a new Map with same keys and values transformed by map function.
func MapEntries ¶ added in v0.5.0
func MapEntries[K, TK comparable, V, TV any](m map[K]V, mapper func(K, V) (TK, TV)) map[TK]TV
MapEntries maps keys and values. Returns a new Map with keys and values transformed by map functions.
func MapKeys ¶ added in v0.5.0
func MapKeys[K, W comparable, V any](m map[K]V, mapper types.Mapper[K, W]) map[W]V
MapKeys maps keys. Returns a new Map with keys transformed by map function and same values.
func ReduceEntries ¶ added in v0.3.0
func ReduceEntries[Value any, Key comparable, Element any]( initialValue Value, elements map[Key]Element, reducer func(Value, Key, Element) Value, ) Value
ReduceEntries applies a reducer function to the entries of the map
func ReduceKeys ¶ added in v0.3.0
func ReduceKeys[Value any, Key comparable, Element any]( initialValue Value, elements map[Key]Element, reducer func(Value, Key) Value, ) Value
ReduceKeys applies a reducer function to the keys of the map
func ReduceValues ¶ added in v0.3.0
func ReduceValues[Value any, Key comparable, Element any]( initialValue Value, elements map[Key]Element, reducer func(Value, Element) Value, ) Value
ReduceValues applies a reducer function to the values of the map
func Values ¶
func Values[K comparable, V any](m map[K]V) []V
Types ¶
type Entry ¶
type Entry[K comparable, V any] struct { Key K Value V }
func Entries ¶
func Entries[K comparable, V any](m map[K]V) []Entry[K, V]
Click to show internal directories.
Click to hide internal directories.