setmatrix

package
v25.0.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SetMatrix

type SetMatrix[T comparable] struct {
	// contains filtered or unexported fields
}

SetMatrix is a map of Sets. The zero value is an empty set matrix ready to use.

SetMatrix values are safe for concurrent use.

func (*SetMatrix[T]) Cardinality

func (s *SetMatrix[T]) Cardinality(key string) (cardinality int, ok bool)

Cardinality returns the number of elements in the set for a key.

func (*SetMatrix[T]) Contains

func (s *SetMatrix[T]) Contains(key string, value T) (containsElement, setExists bool)

Contains is used to verify if an element is in a set for a specific key.

func (*SetMatrix[T]) Get

func (s *SetMatrix[T]) Get(key string) ([]T, bool)

Get returns the members of the set for a specific key as a slice.

func (*SetMatrix[T]) Insert

func (s *SetMatrix[T]) Insert(key string, value T) (inserted bool, cardinality int)

Insert inserts the value in the set of a key and returns whether the value is inserted (was not already in the set) and the number of elements in the set.

func (*SetMatrix[T]) Keys

func (s *SetMatrix[T]) Keys() []string

Keys returns all the keys in the map.

func (*SetMatrix[T]) Remove

func (s *SetMatrix[T]) Remove(key string, value T) (removed bool, cardinality int)

Remove removes the value in the set for a specific key.

func (*SetMatrix[T]) String

func (s *SetMatrix[T]) String(key string) (v string, ok bool)

String returns the string version of the set. The empty string is returned if there is no set for key.

Jump to

Keyboard shortcuts

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