Documentation
¶
Index ¶
- type Set
- func (s Set[T]) Add(v T)
- func (s Set[T]) AddMultiple(values ...T) Set[T]
- func (s Set[T]) Clear()
- func (s Set[T]) Diff(another Set[T]) Set[T]
- func (s Set[T]) Equals(another Set[T]) bool
- func (s Set[T]) Filter(filter func(T) bool) iter.Seq[T]
- func (s Set[T]) Has(value T) bool
- func (s Set[T]) HasAll(values ...T) bool
- func (s Set[T]) Intersection(another Set[T]) Set[T]
- func (s Set[T]) Iter() iter.Seq[T]
- func (s Set[T]) MarshalJSON() ([]byte, error)
- func (s Set[T]) Remove(v T)
- func (s Set[T]) Scan(value any) error
- func (s Set[T]) ToArray() []T
- func (s Set[T]) Union(another Set[T]) Set[T]
- func (s Set[T]) UnmarshalJSON(data []byte) error
- func (s Set[T]) UpdateFrom(another Set[T]) Set[T]
- func (s Set[T]) Value() (driver.Value, 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 values methods
func (Set[T]) AddMultiple ¶
func (Set[T]) Equals ¶
Equals returns true if the set has exactly the same values of the another set
func (Set[T]) Filter ¶
Filter returns an iterable with the values that satisfies the filter condition
func (Set[T]) Intersection ¶
Intersection results a Set with values common to the two sets
func (Set[T]) Iter ¶
Iter returns a iterable of the values in the set Due map characteristics, the order is not garanteeded
func (Set[T]) MarshalJSON ¶
MarshalJSON produces a list serialization of the itens. The order of the itens is indetermined, so don't do comparisons between two JSONS
func (Set[T]) Scan ¶
Scan will receive data as string or []byte, marshaled as JSON (e.g. '["a","b","c"]')
func (Set[T]) ToArray ¶
func (s Set[T]) ToArray() []T
ToArray returns an unsorted array with the values of the set
func (Set[T]) UnmarshalJSON ¶
UnmarshalJSON fills the set with data from JSON
func (Set[T]) UpdateFrom ¶
UpdateFrom adds the values from another set to current