set

package
v7.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 3 Imported by: 155

Documentation

Index

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

func CopyStringSet(set StringSet) StringSet

CopyStringSet - returns copy of given set.

func CreateStringSet

func CreateStringSet(sl ...string) StringSet

CreateStringSet - creates new string set with given string values.

func NewStringSet

func NewStringSet() StringSet

NewStringSet - creates new string set.

func (StringSet) Add

func (set StringSet) Add(s string)

Add - adds string to the set.

func (StringSet) ApplyFunc

func (set StringSet) ApplyFunc(applyFn func(string) string) StringSet

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

func (set StringSet) Contains(s string) bool

Contains - checks if string is in the set.

func (StringSet) Difference

func (set StringSet) Difference(sset StringSet) StringSet

Difference - returns the difference with given set as new set.

func (StringSet) Equals

func (set StringSet) Equals(sset StringSet) bool

Equals - checks whether given set is equal to current set or not.

func (StringSet) FuncMatch

func (set StringSet) FuncMatch(matchFn func(string, string) bool, matchString string) StringSet

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

func (set StringSet) Intersection(sset StringSet) StringSet

Intersection - returns the intersection with given set as new set.

func (StringSet) IsEmpty

func (set StringSet) IsEmpty() bool

IsEmpty - returns whether the set is empty or not.

func (StringSet) MarshalJSON

func (set StringSet) MarshalJSON() ([]byte, error)

MarshalJSON - converts to JSON data.

func (StringSet) Remove

func (set StringSet) Remove(s string)

Remove - removes string in the set. It does nothing if string does not exist in the set.

func (StringSet) String

func (set StringSet) String() string

String - returns printable string of the set.

func (StringSet) ToSlice

func (set StringSet) ToSlice() []string

ToSlice - returns StringSet as string slice.

func (StringSet) Union

func (set StringSet) Union(sset StringSet) StringSet

Union - returns the union with given set as new set.

func (*StringSet) UnmarshalJSON

func (set *StringSet) UnmarshalJSON(data []byte) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL