sets

package
Version: v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package sets is a package of set data structures that are strongly typed so it is easy to use in go without the issue of casting from interface{}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Int32s

type Int32s struct {
	// contains filtered or unexported fields
}

Int32s represents a set of Int32s

func NewInt32s

func NewInt32s(initialValues ...int32) *Int32s

NewInt32s initializes a new set of Int32s

func (*Int32s) Add

func (ss *Int32s) Add(values ...int32)

Add will add one or more values to the set

func (*Int32s) Cardinality

func (ss *Int32s) Cardinality() int

Cardinality will return the number of unique elements in the set

func (*Int32s) Contains

func (ss *Int32s) Contains(value int32) bool

Contains will determine if the string provided exists in the set

func (*Int32s) Intersect

func (ss *Int32s) Intersect(ss2 *Int32s) *Int32s

Intersect will return a new set with only the values found in both sets

func (*Int32s) Slice

func (ss *Int32s) Slice() []int32

Slice creates a slice of the values in the set, the values are not sorted

type Int64s

type Int64s struct {
	// contains filtered or unexported fields
}

Int64s represents a set of Int64s

func NewInt64s

func NewInt64s(initialValues ...int64) *Int64s

NewInt64s initializes a new set of Int64s

func (*Int64s) Add

func (ss *Int64s) Add(values ...int64)

Add will add one or more values to the set

func (*Int64s) Cardinality

func (ss *Int64s) Cardinality() int

Cardinality will return the number of unique elements in the set

func (*Int64s) Contains

func (ss *Int64s) Contains(value int64) bool

Contains will determine if the string provided exists in the set

func (*Int64s) Intersect

func (ss *Int64s) Intersect(ss2 *Int64s) *Int64s

Intersect will return a new set with only the values found in both sets

func (*Int64s) Slice

func (ss *Int64s) Slice() []int64

Slice creates a slice of the values in the set, the values are not sorted

type Ints

type Ints struct {
	// contains filtered or unexported fields
}

Ints represents a set of ints

func NewInts

func NewInts(initialValues ...int) *Ints

NewInts initializes a new set of ints

func (*Ints) Add

func (ss *Ints) Add(values ...int)

Add will add one or more values to the set

func (*Ints) Cardinality

func (ss *Ints) Cardinality() int

Cardinality will return the number of unique elements in the set

func (*Ints) Contains

func (ss *Ints) Contains(value int) bool

Contains will determine if the string provided exists in the set

func (*Ints) Intersect

func (ss *Ints) Intersect(ss2 *Ints) *Ints

Intersect will return a new set with only the values found in both sets

func (*Ints) Slice

func (ss *Ints) Slice() []int

Slice creates a slice of the values in the set, the values are not sorted

type Strings

type Strings struct {
	// contains filtered or unexported fields
}

Strings represents a set of strings

func NewStrings

func NewStrings(initialValues ...string) *Strings

NewStrings initializes a new set of strings

func (*Strings) Add

func (ss *Strings) Add(values ...string)

Add will add one or more values to the set

func (*Strings) Cardinality

func (ss *Strings) Cardinality() int

Cardinality will return the number of unique elements in the set

func (*Strings) Contains

func (ss *Strings) Contains(value string) bool

Contains will determine if the string provided exists in the set

func (*Strings) Intersect

func (ss *Strings) Intersect(ss2 *Strings) *Strings

Intersect will return a new set with only the values found in both sets

func (*Strings) Slice

func (ss *Strings) Slice() []string

Creates a slice of the values in the set, the values are not sorted

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL