stringset

package
v2.9.60+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2016 License: MIT Imports: 0 Imported by: 0

README

qlang.io/app/eql/example/stringset.v1

stringset.Type is a set of string, implemented via map[string]struct{} for minimal memory consumption.

Here is an example:

import (
	"qlang.io/app/eql/example/stringset.v1"
)

set := stringset.New("a", "b")
set.Add("c")

if set.Has("d") {
	println("set has item `"d"`")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Type

type Type map[string]empty

Type is a set of string, implemented via map[string]struct{} for minimal memory consumption.

func New

func New(items ...string) Type

New creates a Type from a list of values.

func (Type) Add

func (s Type) Add(item string)

Add adds one item to the set.

func (Type) Delete

func (s Type) Delete(items ...string)

Delete removes all items from the set.

func (Type) Has

func (s Type) Has(item string) bool

Has returns true iff item is contained in the set.

func (Type) HasAll

func (s Type) HasAll(items ...string) bool

HasAll returns true iff all items are contained in the set.

func (Type) Insert

func (s Type) Insert(items ...string)

Insert adds items to the set.

func (Type) IsSuperset

func (s Type) IsSuperset(s2 Type) bool

IsSuperset returns true iff s1 is a superset of s2.

func (Type) Len

func (s Type) Len() int

Len returns the size of the set.

Jump to

Keyboard shortcuts

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