Documentation
¶
Index ¶
- type Map
- func (m *Map[K, V]) All() iter.Seq2[K, V]
- func (m *Map[K, V]) Copy() *Map[K, V]
- func (m *Map[K, V]) Delete(key K) (prev V, deleted bool)
- func (m *Map[K, V]) Get(key K) (value V, ok bool)
- func (m *Map[K, V]) GetPos(pos uint64) (key K, value V, ok bool)
- func (m *Map[K, V]) Keys() []K
- func (m *Map[K, V]) Len() int
- func (m *Map[K, V]) Set(key K, value V) (V, bool)
- func (m *Map[K, V]) Values() []V
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map[K comparable, V any] struct { // contains filtered or unexported fields }
Map is a hashmap. Like map[string]interface{}
func New ¶
func New[K comparable, V any](cap int) *Map[K, V]
New returns a new Map. Like map[string]interface{}
func (*Map[K, V]) All ¶
All returns an iterator over all key/values. This is a replacement for Scan using the new iter package. It's not safe to call or Set or Delete while scanning.
func (*Map[K, V]) Delete ¶
Delete deletes a value for a key. Returns the deleted value, or false when no value was assigned.
func (*Map[K, V]) Get ¶
Get returns a value for a key. Returns false when no value has been assign for key.
func (*Map[K, V]) GetPos ¶
GetPos gets a single keys/value nearby a position. The pos param can be any valid uint64. Useful for grabbing a random item from the map.
Click to show internal directories.
Click to hide internal directories.