set

package
v7.0.95 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2025 License: Apache-2.0 Imports: 4 Imported by: 164

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) AppendBinary added in v7.0.92

func (s StringSet) AppendBinary(b []byte) ([]byte, error)

AppendBinary appends the binary representation of itself to the end of b

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) DecodeMsg added in v7.0.92

func (s *StringSet) DecodeMsg(reader *msgp.Reader) error

DecodeMsg decodes the message from the reader.

func (StringSet) Difference

func (set StringSet) Difference(sset StringSet) StringSet

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

func (StringSet) EncodeMsg added in v7.0.92

func (s StringSet) EncodeMsg(writer *msgp.Writer) error

EncodeMsg encodes the message to the writer. Values are stored as a slice of strings or nil.

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) MarshalBinary added in v7.0.92

func (s StringSet) MarshalBinary() ([]byte, error)

MarshalBinary encodes the receiver into a binary form and returns the result.

func (StringSet) MarshalJSON

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

MarshalJSON - converts to JSON data.

func (StringSet) MarshalMsg added in v7.0.92

func (s StringSet) MarshalMsg(bytes []byte) ([]byte, error)

MarshalMsg encodes the message to the bytes. Values are stored as a slice of strings or nil.

func (StringSet) Msgsize added in v7.0.92

func (s StringSet) Msgsize() int

Msgsize returns the maximum size of the message.

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) ToByteSlices added in v7.0.92

func (set StringSet) ToByteSlices() [][]byte

ToByteSlices - returns StringSet as a sorted slice of byte slices, using only one allocation.

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) UnmarshalBinary added in v7.0.92

func (s *StringSet) UnmarshalBinary(b []byte) error

UnmarshalBinary decodes the binary representation of itself from b

func (*StringSet) UnmarshalJSON

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

UnmarshalJSON - parses JSON data and creates new set with it.

func (*StringSet) UnmarshalMsg added in v7.0.92

func (s *StringSet) UnmarshalMsg(bytes []byte) ([]byte, error)

UnmarshalMsg decodes the message from the bytes.

Jump to

Keyboard shortcuts

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