Documentation ¶
Overview ¶
Package maps contains utility functions to manage maps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filter ¶
func Filter[K comparable, V any](m map[K]V, filter FilterType[K]) map[K]V
Filter filters a map, returning a duplicate which contains only the elements matching the filter function.
func Sub ¶
func Sub[K comparable, V any](m1, m2 map[K]V) map[K]V
Sub removes elements of m2 from m1.
Types ¶
type FilterType ¶
type FilterType[K comparable] func(key K) bool
FilterType is a function type used to filter a map.
func FilterBlacklist ¶
func FilterBlacklist[K comparable](blacklist ...K) FilterType[K]
FilterBlacklist returns a filter function returning true if the key is not the blacklist.
func FilterWhitelist ¶
func FilterWhitelist[K comparable](whitelist ...K) FilterType[K]
FilterWhitelist returns a filter function returning true if the key is in the whitelist.
Click to show internal directories.
Click to hide internal directories.