Documentation ¶
Index ¶
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 thread safe generic map.
func NewMapWithData ¶
func NewMapWithData[K comparable, V any](data map[K]V) Map[K, V]
NewMapWithData creates a new thread safe map with initial data.
func (*Map[K, V]) Load ¶
Load returns the value stored in the map for a key, otherwise false if no value is present.
func (*Map[K, V]) LoadOrStore ¶ added in v0.0.93
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func (*Map[K, V]) Range ¶
Range iterates over the map, calling the provided function for each key/value pair. If the function returns false, the iteration stops.
func (*Map[K, V]) UpdateInTx ¶
func (m *Map[K, V]) UpdateInTx(updateFunc func(map[K]V))
UpdateInTx allows to update the map in a transactional way.
Click to show internal directories.
Click to hide internal directories.