Documentation ¶
Index ¶
- type Set
- func (s Set[T]) Add(values ...T)
- func (s Set[T]) AddSet(other Set[T])
- func (s Set[T]) Contains(value T) bool
- func (s Set[T]) ContainsAll(values ...T) bool
- func (s Set[T]) MarshalJSON() ([]byte, error)
- func (s Set[T]) PtrSlice() []*T
- func (s Set[T]) Remove(value T) bool
- func (s Set[T]) RemoveAll(values ...T)
- func (s Set[T]) Slice() []T
- func (s *Set[T]) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set[T comparable] map[T]struct{}
Set is a container that store unique elements in no particular order. Sets are an alias for map[T]struct{} where T is a comparable type.
func NewSet ¶
func NewSet[T comparable](values ...T) Set[T]
NewSet creates a new Set from a list of values.
func (Set[T]) ContainsAll ¶
ContainsAll returns true if the set contains all the values.
func (Set[T]) MarshalJSON ¶ added in v0.0.2
func (Set[T]) Remove ¶
Remove removes a value from the set. Returns true if the set contained the value.
func (Set[T]) RemoveAll ¶
func (s Set[T]) RemoveAll(values ...T)
RemoveAll removes all values from the set.
func (*Set[T]) UnmarshalJSON ¶ added in v0.0.2
Click to show internal directories.
Click to hide internal directories.