threadsafe

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

New creates and initializes a new Set.

func Difference

func Difference(set1 *Set, sets ...strset.Set) *Set

Difference returns a new set which contains items which are in the first set but not in the others.

func DifferenceThreadsafe

func DifferenceThreadsafe(set1 *Set, sets ...*Set) *Set

DifferenceThreadsafe returns a new set which contains items which are in in the first set but not in the others.

func FromSlice

func FromSlice(items []string) *Set

func Intersection

func Intersection(set1 *Set, sets ...strset.Set) *Set

Intersection returns a new set which contains items that only exist in all given sets.

func IntersectionThreadsafe

func IntersectionThreadsafe(set1 *Set, sets ...*Set) *Set

IntersectionThreadsafe returns a new set which contains items that only exist in all given sets.

func New

func New(ts ...string) *Set

func NewWithSize

func NewWithSize(size int) *Set

NewWithSize creates a new Set and gives make map a size hint.

func SymmetricDifferenceThreadsafe

func SymmetricDifferenceThreadsafe(s *Set, t *Set) *Set

SymmetricDifferenceThreadsafe returns a new set which s is the difference of items which are in one of either, but not in both.

func Union

func Union(set1 *Set, sets ...strset.Set) *Set

Union is the merger of multiple sets. It returns a new set with all the elements present in all the sets that are passed.

func UnionThreadsafe

func UnionThreadsafe(sets ...*Set) *Set

UnionThreadsafe is the merger of multiple sets. It returns a new set with all the elements present in all the sets that are passed.

func (*Set) Add

func (s *Set) Add(items ...string)

Add includes the specified items (one or more) to the Set. The underlying Set s is modified. If passed nothing it silently returns.

func (*Set) Clear

func (s *Set) Clear()

Clear removes all items from the Set.

func (*Set) Copy

func (s *Set) Copy() strset.Set

Copy returns a new Set with a copy of s.

func (*Set) CopyToThreadsafe

func (s *Set) CopyToThreadsafe() *Set

CopyToThreadsafe returns a new Set with a copy of s.

func (*Set) GetOne

func (s *Set) GetOne() string

GetOne returns an item from the set or "" if the set is empty.

func (*Set) GetOne2

func (s *Set) GetOne2() (string, bool)

GetOne2 returns an item from the set. The second value is a bool that is true if an item exists in the set, or false if the set is empty.

func (*Set) Has

func (s *Set) Has(items ...string) bool

Has looks for the existence of items passed. It returns false if nothing is passed. For multiple items it returns true only if all of the items exist.

func (*Set) HasAny

func (s *Set) HasAny(items ...string) bool

HasAny looks for the existence of any of the items passed. It returns false if nothing is passed. For multiple items it returns true if any of the items exist.

func (*Set) IsEqual

func (s *Set) IsEqual(t strset.Set) bool

IsEqual test whether s and t are the same in size and have the same items.

func (*Set) IsEqualThreadsafe

func (s *Set) IsEqualThreadsafe(t *Set) bool

IsEqualThreadsafe test whether s and t are the same in size and have the same items.

func (*Set) IsSubset

func (s *Set) IsSubset(t strset.Set) bool

IsSubset tests whether t is a subset of s.

func (*Set) IsSubsetThreadsafe

func (s *Set) IsSubsetThreadsafe(t *Set) bool

IsSubsetThreadsafe tests whether t is a subset of s.

func (*Set) IsSuperset

func (s *Set) IsSuperset(t strset.Set) bool

IsSuperset tests whether t is a superset of s.

func (*Set) IsSupersetThreadsafe

func (s *Set) IsSupersetThreadsafe(t *Set) bool

IsSupersetThreadsafe tests whether t is a superset of s.

func (*Set) Len

func (s *Set) Len() int

func (*Set) Merge

func (s *Set) Merge(sets ...strset.Set)

Merge is like Union, however it modifies the current Set it's applied on with the given t Set.

func (*Set) MergeThreadsafe

func (s *Set) MergeThreadsafe(sets ...*Set)

MergeThreadsafe is like UnionThreadsafe, however it modifies the current Set it's applied on with the given t Set.

func (*Set) Pop

func (s *Set) Pop() string

Pop deletes and returns an item from the Set. The underlying Set s is modified. If Set is empty, the zero value is returned.

func (*Set) Pop2

func (s *Set) Pop2() (string, bool)

Pop2 tries to delete and return an item from the Set. The underlying Set s is modified. The second value is a bool that is true if the item existed in the set, and false if not. If Set is empty, the zero value and false are returned.

func (*Set) Remove

func (s *Set) Remove(items ...string)

Remove deletes the specified items from the Set. The underlying Set s is modified. If passed nothing it silently returns.

func (*Set) Shrink

func (s *Set) Shrink(targetLen int)

Remove items until len(s) <= targetLen

func (*Set) ShrinkSorted

func (s *Set) ShrinkSorted(targetLen int)

remove items alphabetically until len(s) <= targetLen

func (*Set) Slice

func (s *Set) Slice() []string

List returns a slice of all items.

func (*Set) SliceSorted

func (s *Set) SliceSorted() []string

List returns a sorted slice of all items (a to z).

func (*Set) String

func (s *Set) String() string

String returns a string representation of s

func (*Set) Subtract

func (s *Set) Subtract(sets ...strset.Set)

Subtract removes the Set items contained in sets from Set s

func (*Set) SubtractThreadsafe

func (s *Set) SubtractThreadsafe(sets ...*Set)

SubtractThreadsafe removes the Set items contained in sets from Set s

func (*Set) ToStrset

func (s *Set) ToStrset() strset.Set

Jump to

Keyboard shortcuts

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