Documentation
¶
Overview ¶
Package gmap Author: hyphen Copyright 2023 hyphen. All rights reserved. Create-time: 2023/12/8
Index ¶
- func CollectKey[K comparable, V any](m map[K]V) []K
- func CollectValue[K comparable, V any](m map[K]V) []V
- func ContainsAll[K comparable, V any](m map[K]V, ks ...K) bool
- func ContainsAny[K comparable, V any](m map[K]V, ks ...K) bool
- func ContainsMapAll[K, V comparable, M ~map[K]V](parent, child M) bool
- func ContainsMapAny[K, V comparable, M ~map[K]V](parent, child M) bool
- func ForEach[K comparable, V any](m map[K]V, fc func(K, V))
- func Map[K1, K2 comparable, V1, V2 any](m map[K1]V1, fc func(K1, V1) (K2, V2)) map[K2]V2
- func Reverse[K, V comparable](m map[K]V) map[V]K
- func SafeStore[K comparable, V any, M ~map[K]V](m M, k K, v V)
- func ToSlice[K comparable, V, T any](m map[K]V, fc KVTrans[K, V, T]) []T
- func Union[K comparable, V any](ms ...map[K]V) map[K]V
- func UnionOnConflict[K comparable, V any, M ~map[K]V](ms []M, fc OnConflict[K, V]) map[K]V
- func UseKey[K comparable, V any](k K, v V) K
- func UseNew[K comparable, V any](k K, old, new V) V
- func UseOld[K comparable, V any](k K, old, new V) V
- func UsePair[K comparable, V any](k K, v V) *gutils.Pair[K, V]
- func UseValue[K comparable, V any](k K, v V) V
- func UseZero[K comparable, V any](k K, old, new V) (v V)
- type KVTrans
- type OnConflict
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectKey ¶
func CollectKey[K comparable, V any](m map[K]V) []K
func CollectValue ¶
func CollectValue[K comparable, V any](m map[K]V) []V
func ContainsAll ¶ added in v0.3.0
func ContainsAll[K comparable, V any](m map[K]V, ks ...K) bool
func ContainsAny ¶ added in v0.3.0
func ContainsAny[K comparable, V any](m map[K]V, ks ...K) bool
func ContainsMapAll ¶ added in v0.3.0
func ContainsMapAll[K, V comparable, M ~map[K]V](parent, child M) bool
func ContainsMapAny ¶ added in v0.3.0
func ContainsMapAny[K, V comparable, M ~map[K]V](parent, child M) bool
func ForEach ¶
func ForEach[K comparable, V any](m map[K]V, fc func(K, V))
func Map ¶
func Map[K1, K2 comparable, V1, V2 any](m map[K1]V1, fc func(K1, V1) (K2, V2)) map[K2]V2
func Reverse ¶
func Reverse[K, V comparable](m map[K]V) map[V]K
func SafeStore ¶
func SafeStore[K comparable, V any, M ~map[K]V](m M, k K, v V)
func ToSlice ¶
func ToSlice[K comparable, V, T any](m map[K]V, fc KVTrans[K, V, T]) []T
func Union ¶
func Union[K comparable, V any](ms ...map[K]V) map[K]V
func UnionOnConflict ¶
func UnionOnConflict[K comparable, V any, M ~map[K]V](ms []M, fc OnConflict[K, V]) map[K]V
func UseKey ¶
func UseKey[K comparable, V any](k K, v V) K
func UseNew ¶
func UseNew[K comparable, V any](k K, old, new V) V
func UseOld ¶
func UseOld[K comparable, V any](k K, old, new V) V
func UseValue ¶
func UseValue[K comparable, V any](k K, v V) V
func UseZero ¶
func UseZero[K comparable, V any](k K, old, new V) (v V)
Types ¶
type KVTrans ¶
type KVTrans[K comparable, V, T any] func(K, V) T
type OnConflict ¶
type OnConflict[K comparable, V any] func(k K, old, new V) V
Click to show internal directories.
Click to hide internal directories.