package setmatrix

import "github.com/dotcloud/docker/libnetwork/internal/setmatrix"

Index

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.

Source Files

setmatrix.go

Version
v28.1.1+incompatible (latest)
Published
Apr 18, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
3 hours ago

Tools for package owners.