Documentation ¶
Index ¶
- type Set
- func (s Set) Add(items ...string)
- func (s *Set) Clear()
- func (s Set) Copy() Set
- func (s Set) Has(items ...string) bool
- func (s Set) HasAny(items ...string) bool
- func (s Set) IsEqual(t Set) bool
- func (s Set) IsSubset(t Set) bool
- func (s Set) IsSuperset(t Set) bool
- func (s Set) Merge(sets ...Set)
- func (s Set) Pop() string
- func (s Set) Pop2() (string, bool)
- func (s Set) Remove(items ...string)
- func (s Set) Slice() []string
- func (s Set) String() string
- func (s Set) Subtract(sets ...Set)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set map[string]struct{}
Set functionality adapted from github.com/scylladb/go-set
func Difference ¶
Difference returns a new set which contains items which are in in the first set but not in the others.
func Intersection ¶
Intersection returns a new set which contains items that only exist in all given sets.
func NewWithSize ¶
NewWithSize creates a new Set and gives make map a size hint.
func SymmetricDifference ¶
SymmetricDifference returns a new set which s is the difference of items which are in one of either, but not in both.
func Union ¶
Union is the merger of multiple sets. It returns a new set with all the elements present in all the sets that are passed.
func (Set) Add ¶
Add includes the specified items (one or more) to the Set. The underlying Set s is modified. If passed nothing it silently returns.
func (Set) Has ¶
Has looks for the existence of items passed. It returns false if nothing is passed. For multiple items it returns true only if all of the items exist.
func (Set) HasAny ¶
HasAny looks for the existence of any of the items passed. It returns false if nothing is passed. For multiple items it returns true if any of the items exist.
func (Set) IsSuperset ¶
IsSuperset tests whether t is a superset of s.
func (Set) Merge ¶
Merge is like Union, however it modifies the current Set it's applied on with the given t Set.
func (Set) Pop ¶
Pop deletes and returns an item from the Set. The underlying Set s is modified. If Set is empty, the zero value is returned.
func (Set) Pop2 ¶
Pop2 tries to delete and return an item from the Set. The underlying Set s is modified. The second value is a bool that is true if the item existed in the set, and false if not. If Set is empty, the zero value and false are returned.