Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetToSlice ¶
func SetToSlice[V comparable](m map[V]struct{}) []V
SetToSlice returns a slice containing the keys of the provided Set/map
func SliceToSet ¶
func SliceToSet[V comparable](s []V) map[V]struct{}
SliceToSet returns a Set/map whose keys are formed by the values in the slice argument. It will deduplicate any repeated value in the slice
Types ¶
type Bits ¶
type Bits uint
Bits wraps an unsigned integer that can be used as a bit map
func MappedBits ¶
func MappedBits[T comparable](values []T, maps map[T]Bits, opts ...BuilderOpt[T]) Bits
MappedBits builds a Bits map from a set of values (e.g. strings) that are mapped in the form value --> corresponding Bits value in the "maps" constructor argument
type BuilderOpt ¶
type BuilderOpt[T any] func(*builderOpts[T])
BuilderOpt allows defining option for building Bits map in the MappedBits method
func WithTransform ¶
func WithTransform[T any](transformFunc func(T) T) BuilderOpt[T]
WithTransform will apply the provided transformer function to the passed key values in the MappedBits constructor function
type Map2 ¶
type Map2[K1, K2 comparable, V any] map[K1]map[K2]V
Map2 implements a 2-level map where each 1st-level key maps to a 2nd level map.
type MultiCounter ¶
type MultiCounter[K comparable] map[K]*int
MultiCounter maps a counter to a given key
func (MultiCounter[K]) Dec ¶
func (m MultiCounter[K]) Dec(key K) int
Dec decrements the counter associated to the given key and returns the new count.
func (MultiCounter[K]) Inc ¶
func (m MultiCounter[K]) Inc(key K) int
Inc increments the counter associated to the given key and returns the new count.