Documentation ¶
Index ¶
- type StringSet
- func (set StringSet) Add(s string)
- func (set StringSet) ApplyFunc(applyFn func(string) string) StringSet
- func (set StringSet) Contains(s string) bool
- func (set StringSet) Difference(sset StringSet) StringSet
- func (set StringSet) Equals(sset StringSet) bool
- func (set StringSet) FuncMatch(matchFn func(string, string) bool, matchString string) StringSet
- func (set StringSet) Intersection(sset StringSet) StringSet
- func (set StringSet) IsEmpty() bool
- func (set StringSet) MarshalJSON() ([]byte, error)
- func (set StringSet) Remove(s string)
- func (set StringSet) String() string
- func (set StringSet) ToSlice() []string
- func (set StringSet) Union(sset StringSet) StringSet
- func (set *StringSet) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StringSet ¶
type StringSet map[string]struct{}
StringSet - uses map as set of strings.
func CopyStringSet ¶
CopyStringSet - returns copy of given set.
func CreateStringSet ¶
CreateStringSet - creates new string set with given string values.
func (StringSet) ApplyFunc ¶
ApplyFunc - returns new set containing each value processed by 'applyFn'. A 'applyFn' should accept element in a set as a argument and return a processed string. The function can do any logic to return a processed string.
func (StringSet) Contains ¶
Contains - checks if string is in the set.
func (StringSet) Difference ¶
Difference - returns the difference with given set as new set.
func (StringSet) Equals ¶
Equals - checks whether given set is equal to current set or not.
func (StringSet) FuncMatch ¶
FuncMatch - returns new set containing each value who passes match function. A 'matchFn' should accept element in a set as first argument and 'matchString' as second argument. The function can do any logic to compare both the arguments and should return true to accept element in a set to include in output set else the element is ignored.
func (StringSet) Intersection ¶
Intersection - returns the intersection with given set as new set.
func (StringSet) IsEmpty ¶
IsEmpty - returns whether the set is empty or not.
func (StringSet) MarshalJSON ¶
MarshalJSON - converts to JSON data.
func (StringSet) Remove ¶
Remove - removes string in the set. It does nothing if string does not exist in the set.
func (StringSet) String ¶
String - returns printable string of the set.
func (StringSet) ToSlice ¶
ToSlice - returns StringSet as string slice.
func (StringSet) Union ¶
Union - returns the union with given set as new set.
func (*StringSet) UnmarshalJSON ¶
UnmarshalJSON - parses JSON data and creates new set with it. If 'data' contains JSON string array, the set contains each string. If 'data' contains JSON string, the set contains the string as one element. If 'data' contains Other JSON types, JSON parse error is returned.