Documentation
¶
Index ¶
- func AllKeys[M ~map[K]V, K comparable, V any](m M) []K
- func AllValues[M ~map[K]V, K comparable, V any](m M) []V
- func MapValues[K comparable, V any, R any](input map[K]V, f func(K, V) R) map[K]R
- func SortedKeys[M ~map[K]V, K cmp.Ordered, V any](m M) []K
- type Sync
- func (s *Sync[K, V]) CompareAndDelete(k K, old V) bool
- func (s *Sync[K, V]) CompareAndSwap(k K, old, n V) bool
- func (s *Sync[K, V]) Delete(k K)
- func (s *Sync[K, V]) Load(k K) (V, bool)
- func (s *Sync[K, V]) LoadAndDelete(k K) (V, bool)
- func (s *Sync[K, V]) LoadOrStore(k K, store V) (V, bool)
- func (s *Sync[K, V]) Range(f func(k K, v V) bool)
- func (s *Sync[K, V]) Store(k K, v V)
- func (s *Sync[K, V]) Swap(k K, v V) (V, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllKeys ¶ added in v2.10.9
func AllKeys[M ~map[K]V, K comparable, V any](m M) []K
func AllValues ¶ added in v2.10.9
func AllValues[M ~map[K]V, K comparable, V any](m M) []V
func MapValues ¶ added in v2.11.8
func MapValues[K comparable, V any, R any](input map[K]V, f func(K, V) R) map[K]R
func SortedKeys ¶
Types ¶
type Sync ¶
type Sync[K, V any] struct { // contains filtered or unexported fields }
Sync is a simple wrapper around sync.Map that provides type-safe methods
func (*Sync[K, V]) CompareAndDelete ¶
func (*Sync[K, V]) CompareAndSwap ¶
func (*Sync[K, V]) LoadAndDelete ¶
func (*Sync[K, V]) LoadOrStore ¶
Click to show internal directories.
Click to hide internal directories.