Documentation ¶
Overview ¶
Package maputil provides basic utility functions for generic maps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Difference ¶ added in v1.3.0
func Difference[M ~map[K]V, K comparable, V any](a, b M) M
Difference returns all the elements in 'a' that are not in 'b'.
func Filter ¶
func Filter[M ~map[K]V, K comparable, V any](m M, p ...func(k K, v V) bool) M
Filter removes all key/value pairs in the given map that do not match the given predicates.
NOTE: Providing no predicates results in a no-op.
func Keys ¶
func Keys[M ~map[K]V, K comparable, V any](m M, p ...func(k K, v V) bool) []K
Keys returns the keys from the given map.
NOTE: When provided with one or more predicates, only returns keys which match all predicates.
func Values ¶
func Values[M ~map[K]V, K comparable, V any](m M, p ...func(k K, v V) bool) []V
Values returns the values from the given map.
NOTE: When provided with one or more predicates, only returns values which match all predicates.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.