stringset

package
v10.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(a, b StringSet) bool

Equal compares if two StringSets have the same values

Types

type MapStringSet

type MapStringSet map[string]StringSet

MapStringSet is a Map of StringSets.

func (MapStringSet) Add

func (mss MapStringSet) Add(n, v string)

Add adds a new value to the Map. If n is already in the map, then v is appended to the StringSet under that key. Otherwise a new StringSet is creayed containing v

type StringSet

type StringSet map[string]struct{}

StringSet is a basic set implementation for strings. This is used a lot so it deserves its own type. Other types of sets are used throughout the code but do not have their own typedef. String sets and <type>sets should be used throughout the code when applicable, they are a lot more flexible than slices and provide easy lookup.

func FromSlice

func FromSlice(in []string) StringSet

FromSlice creates a new StringSet from an input slice

func Make

func Make(in ...string) StringSet

Make creates a new StringSet from a set of arguments

func (StringSet) Copy

func (set StringSet) Copy() StringSet

Copy copies a StringSet into a new structure of the same type.

func (StringSet) Extend

func (set StringSet) Extend(s ...string)

Extend sets multiple keys in StringSet.

func (StringSet) Get

func (set StringSet) Get(v string) bool

Get returns true if the key exists in the set.

func (StringSet) Remove

func (set StringSet) Remove(v string)

Remove deletes a key from the set.

func (StringSet) Set

func (set StringSet) Set(v string)

Set sets key in StringSet.

func (StringSet) ToSlice

func (set StringSet) ToSlice() []string

ToSlice turns all keys into a string slice.

Jump to

Keyboard shortcuts

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