Documentation ¶
Index ¶
- type Mapping
- func (kv *Mapping[K, V]) Del(k K)
- func (kv *Mapping[K, V]) Exists(ks ...K) bool
- func (kv *Mapping[K, V]) InnerMap() map[K]V
- func (kv *Mapping[K, V]) InsertNew(key K, value V)
- func (kv *Mapping[K, V]) IterateFunc(f func(k K, v V))
- func (kv *Mapping[K, V]) ListAllKeys() []K
- func (kv *Mapping[K, V]) ListValues() []V
- func (kv *Mapping[K, V]) MustExists(keys ...K)
- func (kv *Mapping[K, V]) MustGet(key K) V
- func (kv *Mapping[K, V]) TryDel(k K) bool
- func (kv *Mapping[K, V]) TryGet(key K) (V, bool)
- func (kv *Mapping[K, V]) Update(key K, value V)
- type Set
- type VecVec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mapping ¶
type Mapping[K comparable, V any] struct { // contains filtered or unexported fields }
Mapping wraps a map and adds utility functions
func (*Mapping[K, V]) Del ¶
func (kv *Mapping[K, V]) Del(k K)
Delete an entry. Panic if the entry was not found
func (*Mapping[K, V]) InsertNew ¶
func (kv *Mapping[K, V]) InsertNew(key K, value V)
InsertNew inserts a new value and panics if it was contained already
func (*Mapping[K, V]) IterateFunc ¶
func (kv *Mapping[K, V]) IterateFunc(f func(k K, v V))
Iterates a function over all elements of the map
func (*Mapping[K, V]) ListAllKeys ¶
func (kv *Mapping[K, V]) ListAllKeys() []K
Returns the list of all the keys
func (*Mapping[K, V]) ListValues ¶
func (kv *Mapping[K, V]) ListValues() []V
ToSlice lists all entries in a slice of tuple
func (*Mapping[K, V]) MustExists ¶
func (kv *Mapping[K, V]) MustExists(keys ...K)
Panic if the given entry does not exists
func (*Mapping[K, V]) MustGet ¶
func (kv *Mapping[K, V]) MustGet(key K) V
Attempts to retrieve a value from a given key. Panics if it fails
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
A set is an unordered collection addressed by keys, which supports
type VecVec ¶
type VecVec[T any] struct { // contains filtered or unexported fields }
VecVec is a wrapper around double vecs The inner slice is append only
func NewVecVec ¶
Constructor for double vecs. Can optionally give it an initial length (by default set to zero)
func (*VecVec[T]) AppendToInner ¶
Append one or more values to the given subslice. Will extend the larger size to match the requested position if necessary
func (*VecVec[T]) LenOf ¶
Returns the length of an inner slice, also allocate the slice if it was not allocated, it will reserve it.