Documentation ¶
Index ¶
- func FilterFunc[K comparable, V any](oldMap map[K]V, cmp func(key K, val V) (ok bool)) (newMap map[K]V)
- func FilterWithPrefix[V any](oldMap map[string]V, prefix string) (newMap map[string]V)
- func ProjectFunc[K comparable, V any](oldMap map[K]V, proj func(oldKey K, val V) (newKey K, ok bool)) (newMap map[K]V)
- func ProjectWithPrefix[V any](oldMap map[string]V, prefix string) (newMap map[string]V)
- func Value[K comparable, V any](m map[K]V, key K, defVal ...V) V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterFunc ¶
func FilterFunc[K comparable, V any](oldMap map[K]V, cmp func(key K, val V) (ok bool)) (newMap map[K]V)
FilterFunc filters a map by a custom function, the function should return a boolean indicating if the key should be included.
func FilterWithPrefix ¶
FilterWithPrefix filters a map by a prefix, only keys with the prefix will be included.
func ProjectFunc ¶
func ProjectFunc[K comparable, V any](oldMap map[K]V, proj func(oldKey K, val V) (newKey K, ok bool)) (newMap map[K]V)
ProjectFunc projects a map by a custom function, the function should return the new key and a boolean indicating if the key should be included.
func ProjectWithPrefix ¶
ProjectWithPrefix projects a map by a prefix, only keys with the prefix will be included, and the prefix will be removed from the keys.
func Value ¶ added in v0.1.1
func Value[K comparable, V any](m map[K]V, key K, defVal ...V) V
Value returns the value of a key in a map, if the key does not exist, the default value will be returned.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.