Documentation ¶
Overview ¶
replacing this with `https://pkg.go.dev/golang.org/x/exp/maps` should be considered when `x/exp/maps` graduates to stable.
Index ¶
- func Contains[K, V comparable, A ~map[K]V, B ~map[K]V](a A, b B) bool
- func HaveConflict[K comparable, V comparable, S ~map[K]V](a, b S) error
- func Intersect[K comparable, V any, M ~map[K]V](a, b M, commonKeyValue func(a, b V) V) M
- 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
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 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 Intersect ¶ added in v0.5.0
func Intersect[K comparable, V any, M ~map[K]V](a, b M, commonKeyValue func(a, b V) V) M
Intersect returns the intersection of a and b with the values generated by calling commonKeyValue
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
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.