Documentation ¶
Index ¶
- func Contains[K, V comparable, A ~map[K]V, B ~map[K]V](a A, b B) bool
- func DeepCopySets[T comparable](src map[string]sets.Set[T]) map[string]sets.Set[T]
- func FilterKeys[K comparable, V any, M ~map[K]V](m M, k []K) M
- func HaveConflict[K comparable, V comparable, S ~map[K]V](a, b S) error
- func Keys[K comparable, V any, M ~map[K]V](m M) []K
- func Merge[K comparable, V any, S ~map[K]V](a, b S, commonKeyValue func(a, b V) V) S
- func MergeKeepFirst[K comparable, V any, S ~map[K]V](a, b S) S
- func SortedKeys[K cmp.Ordered, V any, M ~map[K]V](m M) []K
- func Values[M ~map[K]V, K comparable, V any](m M) []V
- type SyncMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶ added in v0.5.0
func Contains[K, V comparable, A ~map[K]V, B ~map[K]V](a A, b B) bool
Contains returns true if a contains all the keys in b with the same value
func DeepCopySets ¶ added in v0.7.0
DeepCopySets create a deep copy of map[string]Set which would otherwise be referenced
func FilterKeys ¶ added in v0.7.0
func FilterKeys[K comparable, V any, M ~map[K]V](m M, k []K) M
FilterKeys returns a sub-map containing only keys from the given list
func HaveConflict ¶ added in v0.5.0
func HaveConflict[K comparable, V comparable, S ~map[K]V](a, b S) error
HaveConflict checks if a and b have the same key, but different value
func Keys ¶ added in v0.5.0
func Keys[K comparable, V any, M ~map[K]V](m M) []K
Keys returns a slice containing the m keys
func Merge ¶
func Merge[K comparable, V any, S ~map[K]V](a, b S, commonKeyValue func(a, b V) V) S
Merge merges a and b while resolving the conflicts by calling commonKeyValue
func MergeKeepFirst ¶
func MergeKeepFirst[K comparable, V any, S ~map[K]V](a, b S) S
MergeKeepFirst merges a and b keeping the values in a in case of conflict
func SortedKeys ¶ added in v0.9.0
SortedKeys returns a slice containing the sorted m keys
func Values ¶ added in v0.8.0
func Values[M ~map[K]V, K comparable, V any](m M) []V
Values returns the values of the map m. The values will be in an indeterminate order.
Types ¶
type SyncMap ¶ added in v0.7.1
type SyncMap[K comparable, V any] struct { // contains filtered or unexported fields }
SyncMap - generic RWMutex protected map.
func NewSyncMap ¶ added in v0.7.1
func NewSyncMap[K comparable, V any](size int) *SyncMap[K, V]