set

package
v0.0.0-...-bde19ca Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package set provides simple set implementations in go.

Index

Constants

This section is empty.

Variables

View Source
var DummyValue = Value{}

DummyValue is the dummy value used in the map.

Functions

This section is empty.

Types

type String

type String map[string]Value

String defines the string set.

You should initialize it with make(String), or use StringSliceToSet to convert an existing slice.

func StringSliceToSet

func StringSliceToSet(slice []string) String

StringSliceToSet creates a new string set from the existing slice.

func (String) Add

func (s String) Add(item string)

Add adds an item to the set.

func (String) Contains

func (s String) Contains(item string) bool

Contains returns true if item is in the set.

func (String) Equals

func (s String) Equals(other String) bool

Equals returns true if this string set equals to the other string set.

func (String) Remove

func (s String) Remove(item string)

Remove removes an item from the set.

NOTE: Due to a go runtime bug[1], Remove works functionally but does not free the memory held by removed item(s).

[1] https://github.com/golang/go/issues/20135

func (String) String

func (s String) String() string

func (String) ToSlice

func (s String) ToSlice() []string

ToSlice converts the set into a string slice.

There's no guaranteed order of the slice to be returned.

type Value

type Value struct{}

Value is the value type used in the map.

Jump to

Keyboard shortcuts

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