setmatrix

package
v25.0.13+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 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[K, V 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[K, V]) Cardinality

func (s *SetMatrix[K, V]) Cardinality(key K) (cardinality int, ok bool)

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

func (*SetMatrix[K, V]) Contains

func (s *SetMatrix[K, V]) Contains(key K, value V) (containsElement, setExists bool)

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

func (*SetMatrix[K, V]) Get

func (s *SetMatrix[K, V]) Get(key K) ([]V, bool)

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

func (*SetMatrix[K, V]) Insert

func (s *SetMatrix[K, V]) Insert(key K, value V) (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[K, V]) Keys

func (s *SetMatrix[K, V]) Keys() []K

Keys returns all the keys in the map.

func (*SetMatrix[K, V]) Remove

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

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

func (*SetMatrix[K, V]) String

func (s *SetMatrix[K, V]) String(key K) (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