stringkeyed

package
v0.0.0-...-d5fe2e5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 7 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 {
	// contains filtered or unexported fields
}

Set is a set of strings that is comparable with == and !=. The zero value is a valid and empty set.

func SetOf

func SetOf(elems ...string) (s Set)

SetOf returns a new Set containing the provided elements.

func (*Set) Add

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

Add adds the provided elements to s if it does not already contain them. In other words, it makes s the union of the elements already in s and the elements provided.

func (Set) Cardinality

func (s Set) Cardinality() int

Cardinality returns the cardinality of s; that is, the number of elements it contains. It is more efficient than computing the length of the slice returned by ToSlice.

func (Set) MarshalJSON

func (s Set) MarshalJSON() ([]byte, error)

func (Set) ToSlice

func (s Set) ToSlice() []string

ToSlice returns a sorted slice of the elements in s.

func (*Set) UnmarshalJSON

func (s *Set) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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