Documentation
¶
Index ¶
- func Add[K comparable](this map[K]bool, keys ...K)
- func AddWithValue[K comparable, V any](this map[K]V, value V, keys ...K)
- func AnyOf[K comparable, V any](this, other map[K]V) bool
- func Contains[K comparable, V any](this map[K]V, key K) bool
- func ContainsAll[K comparable, V any](this map[K]V, keys ...K) bool
- func ContainsAny[K comparable, V any](this map[K]V, keys ...K) bool
- func Difference[K comparable, V any](this, other map[K]V) map[K]V
- func Discard[K comparable, V any](this, other map[K]V)
- func Intersection[K comparable, V any](this, other map[K]V) map[K]V
- func Keys[K comparable, V any](this map[K]V) []K
- func NewSet[K comparable](keys ...K) map[K]bool
- func NewSetWithValue[K comparable, V any](value V, keys ...K) map[K]V
- func Remove[K comparable, V any](this map[K]V, keys ...K)
- func SortedKeys[K cmp.Ordered, V any](this map[K]V) []K
- func SubsetOf[K comparable, V any](this, other map[K]V) bool
- func Union[K comparable, V any](this, other map[K]V) map[K]V
- func Update[K comparable, V any](this, other map[K]V)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶ added in v0.11.0
func Add[K comparable](this map[K]bool, keys ...K)
Add all given keys to this set using "true" as the map value.
Useful for sets created by NewSet.
func AddWithValue ¶ added in v0.11.0
func AddWithValue[K comparable, V any](this map[K]V, value V, keys ...K)
AddWithValue adds multiple keys to this set, each with the same value.
Useful for sets created by NewSetWithValue.
func AnyOf ¶
func AnyOf[K comparable, V any](this, other map[K]V) bool
AnyOf returns true if any key in this set is in the other set.
func Contains ¶
func Contains[K comparable, V any](this map[K]V, key K) bool
Contains returns true if this set contains the given key.
func ContainsAll ¶
func ContainsAll[K comparable, V any](this map[K]V, keys ...K) bool
ContainsAll returns true if this set contains every given key.
func ContainsAny ¶
func ContainsAny[K comparable, V any](this map[K]V, keys ...K) bool
ContainsAny returns true if this set contains any given key.
func Difference ¶
func Difference[K comparable, V any](this, other map[K]V) map[K]V
Difference returns a new set containing all keys in this set that don't exist in the other set.
func Discard ¶
func Discard[K comparable, V any](this, other map[K]V)
Discard all keys from this set that exist in the other set.
func Intersection ¶
func Intersection[K comparable, V any](this, other map[K]V) map[K]V
Intersection returns a new set containing only keys that exist in both sets.
func Keys ¶
func Keys[K comparable, V any](this map[K]V) []K
Keys returns an unsorted slice of all keys from this set.
func NewSet ¶
func NewSet[K comparable](keys ...K) map[K]bool
NewSet creates a new set using "true" as the map value.
func NewSetWithValue ¶
func NewSetWithValue[K comparable, V any](value V, keys ...K) map[K]V
NewSetWithValue creates a set with each key given the same value.
func Remove ¶ added in v0.11.0
func Remove[K comparable, V any](this map[K]V, keys ...K)
Remove all keys from this set that exist in the given slice.
func SortedKeys ¶
SortedKeys returns a sorted slice of all keys from this set.
func SubsetOf ¶
func SubsetOf[K comparable, V any](this, other map[K]V) bool
SubsetOf returns true if every key in this set is in the other set.
func Union ¶
func Union[K comparable, V any](this, other map[K]V) map[K]V
Union returns a new set containing all keys from both sets.
func Update ¶
func Update[K comparable, V any](this, other map[K]V)
Update adds every key from the other set to this set.
Types ¶
This section is empty.