Documentation ¶
Overview ¶
Package set provides set datastructure.
Index ¶
- func MapstructureDecodeHookFromListToStrSet(fromType, toType reflect.Type, from interface{}) (interface{}, error)
- type StrSet
- func (set *StrSet) Add(k string) error
- func (set *StrSet) AddSet(other StrSet) error
- func (set *StrSet) AddSets(others ...StrSet) error
- func (set *StrSet) Adds(args ...string) error
- func (set StrSet) Clear()
- func (set StrSet) Clone() StrSet
- func (set StrSet) Has(k string) bool
- func (set *StrSet) HasAll(args ...string) bool
- func (set *StrSet) HasAny(args ...string) bool
- func (set StrSet) MarshalJSON() ([]byte, error)
- func (set StrSet) Remove(k string)
- func (set StrSet) Removes(args ...string)
- func (set StrSet) ToList() []string
- func (set StrSet) ToMap(deep bool) map[string]struct{}
- func (set *StrSet) UnmarshalJSON(b []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MapstructureDecodeHookFromListToStrSet ¶
func MapstructureDecodeHookFromListToStrSet(fromType, toType reflect.Type, from interface{}) (interface{}, error)
MapstructureDecodeHookFromListToStrSet decodes []interface{} to StrSet. This function implements the mapstructure.DecodeHookFuncType interface. https://godoc.org/github.com/mitchellh/mapstructure#DecodeHookFuncType
Types ¶
type StrSet ¶
type StrSet map[string]struct{}
StrSet represents a string set.
func (StrSet) Clear ¶
func (set StrSet) Clear()
Clear removes all elements. If set is nil, nothing happens.
func (StrSet) Clone ¶
Clone returns a new StrSet which has same elements. If set is nil, new empty set is returned.
func (StrSet) Has ¶
Has returns whether a given string is included in the set. If set is nil, false is returned.
func (*StrSet) HasAll ¶
HasAll returns whether all given strings are included in the set. If set is nil, false is returned.
func (*StrSet) HasAny ¶
HasAny returns whether some given strings are included in the set. If set is nil, false is returned.
func (StrSet) MarshalJSON ¶
MarshalJSON is the implementation of the json.Marshaler interface.
func (StrSet) ToList ¶
ToList returns a list composed of elements of the set. If set is nil, an empty list is returned.
func (StrSet) ToMap ¶
ToMap returns a map whose keys are elements of the set. If the parameter 'deep' is true, this method returns a new map. If the parameter 'deep' is false, this method returns the map which the set has internally. If set is nil, an empty map is returned.
func (*StrSet) UnmarshalJSON ¶
UnmarshalJSON is the implementation of the json.Unmarshaler interface. An error is returned when set is nil.