Documentation
¶
Index ¶
- func AddAll(set Interface, elements ...string)
- func ContainsAll(set Interface, elements ...string) bool
- func Equals(s1 Interface, s2 Interface) bool
- func IsEmpty(set Interface) bool
- func RemoveAll(set Interface, elements ...string)
- func Subset(super Interface, sub Interface) bool
- type Criteria
- type Interface
- type Ordered
- func (s *Ordered) Add(element string)
- func (s *Ordered) All(criteria Criteria) bool
- func (s *Ordered) Any(criteria Criteria) bool
- func (s *Ordered) Array() []string
- func (s *Ordered) Contains(element string) bool
- func (s *Ordered) IsZero() bool
- func (s *Ordered) MarshalJSON() ([]byte, error)
- func (s *Ordered) MarshalYAML() (interface{}, error)
- func (s *Ordered) None(criteria Criteria) bool
- func (s *Ordered) One() string
- func (s *Ordered) Remove(element string)
- func (s *Ordered) Scan(src interface{}) error
- func (s *Ordered) Size() int
- func (s *Ordered) SpaceJoin() string
- func (s *Ordered) UnmarshalJSON(bytes []byte) error
- func (s *Ordered) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (s *Ordered) Value() (driver.Value, error)
- type UnOrdered
- func (s *UnOrdered) Add(element string)
- func (s *UnOrdered) All(criteria Criteria) bool
- func (s *UnOrdered) Any(criteria Criteria) bool
- func (s *UnOrdered) Array() []string
- func (s *UnOrdered) Contains(element string) bool
- func (s *UnOrdered) IsZero() bool
- func (s *UnOrdered) MarshalJSON() ([]byte, error)
- func (s *UnOrdered) MarshalYAML() (interface{}, error)
- func (s *UnOrdered) None(criteria Criteria) bool
- func (s *UnOrdered) One() string
- func (s *UnOrdered) Remove(element string)
- func (s *UnOrdered) Scan(src interface{}) error
- func (s *UnOrdered) Size() int
- func (s *UnOrdered) UnmarshalJSON(bytes []byte) error
- func (s *UnOrdered) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (s *UnOrdered) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsAll ¶
ContainsAll returns true if the set contains all given elements
Types ¶
type Interface ¶
type Interface interface { json.Marshaler json.Unmarshaler yaml.Marshaler yaml.Unmarshaler yaml.IsZeroer sql.Scanner driver.Valuer // Size returns the size of the set. If set is nil, returns 0. Size() int // Contains returns true if the queried element is in the set. Contains(element string) bool // Add adds the given element to the set, if it does not already exist. Adding to a nil set has no effect. Add(element string) // Remove removes the given element from the set, if it exists. Remove(element string) // All returns true if all elements in the set matches the given criteria. Empty set always returns false. All(criteria Criteria) bool // Any returns true if at least one element in the set matches given criteria. Empty set always returns false. Any(criteria Criteria) bool // None returns true if none elements in the set matches given criteria. Empty set always returns false. None(criteria Criteria) bool // Array returns a copied slice of the elements in this set in ordered fashion. Subsequent operations on the returned // slice will not affect the set in any way. If set is nil or empty, an empty slice is returned. Array() []string // One returns one element from this set. It is usually invoked when Size is 1, but can be implemented for // any Size greater than 0. If set is empty, implementations should panic. One() string }
Interface is the main abstraction for a string set data structure.
type Ordered ¶
type Ordered struct {
// contains filtered or unexported fields
}
Ordered is a ordered set data structure for strings.
func NewOrderedBy ¶
NewOrderedBy returns a new order string set with delimited elements from the value string.
func NewOrderedBySpace ¶
NewOrderedBySpace is NewOrderedBy with space delimiter.
func NewOrderedWith ¶
NewOrderedWith returns a new order string set with given elements.
func (*Ordered) MarshalJSON ¶
func (*Ordered) MarshalYAML ¶
func (*Ordered) UnmarshalJSON ¶
func (*Ordered) UnmarshalYAML ¶
type UnOrdered ¶
type UnOrdered struct {
// contains filtered or unexported fields
}
func NewUnOrderedWith ¶
NewUnOrderedWith returns a new unordered string set with given elements.
func (*UnOrdered) MarshalJSON ¶
func (*UnOrdered) MarshalYAML ¶
func (*UnOrdered) UnmarshalJSON ¶
func (*UnOrdered) UnmarshalYAML ¶
Click to show internal directories.
Click to hide internal directories.