Documentation
¶
Index ¶
- func Add[K comparable, V any](mp map[K]V, k K, v V)
- func Exists[K comparable, V any](mp map[K]V, key K) bool
- func Forget[K comparable, V any](mp map[K]V, keys ...K)
- func FromStruct(data any) map[string]any
- func Get[K comparable, V any](mp map[K]V, key K, defaults ...V) V
- func Has[K comparable, V any](mp map[K]V, keys ...K) bool
- func HasAny[K comparable, V any](mp map[K]V, keys ...K) bool
- func Only[K comparable, V any](mp map[K]V, keys ...K) map[K]V
- func Pull[K comparable, V any](mp map[K]V, key K, def ...V) V
- func Set[K comparable, V any](mp map[K]V, k K, v V)
- func Where[K comparable, V any](mp map[K]V, callback func(K, V) bool) map[K]V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add[K comparable, V any](mp map[K]V, k K, v V)
Add an element to a map if it doesn't exist.
func Exists ¶
func Exists[K comparable, V any](mp map[K]V, key K) bool
Exists checks if the given key exists in the provided map.
func Forget ¶
func Forget[K comparable, V any](mp map[K]V, keys ...K)
Forget removes a given key or keys from the provided map.
func FromStruct ¶
func Get ¶
func Get[K comparable, V any](mp map[K]V, key K, defaults ...V) V
Get an element from a map
func Has ¶
func Has[K comparable, V any](mp map[K]V, keys ...K) bool
Has checks if the given key or keys exist in the provided map.
func HasAny ¶
func HasAny[K comparable, V any](mp map[K]V, keys ...K) bool
HasAny checks if the given key or keys exist in the provided map.
func Only ¶
func Only[K comparable, V any](mp map[K]V, keys ...K) map[K]V
Only returns the items in the map with the specified keys.
func Pull ¶
func Pull[K comparable, V any](mp map[K]V, key K, def ...V) V
Pull returns a new map with the specified keys removed.
func Where ¶
func Where[K comparable, V any](mp map[K]V, callback func(K, V) bool) map[K]V
Where filters the items in a map using the given callback.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.