maps

package
v0.0.0-...-7234793 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortedKeys

func SortedKeys[M ~map[K]V, K constraints.Ordered, V any](m M) []K

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 (s *Sync[K, V]) CompareAndDelete(k K, old V) bool

func (*Sync[K, V]) CompareAndSwap

func (s *Sync[K, V]) CompareAndSwap(k K, old, new V) bool

func (*Sync[K, V]) Delete

func (s *Sync[K, V]) Delete(k K)

func (*Sync[K, V]) Load

func (s *Sync[K, V]) Load(k K) (V, bool)

func (*Sync[K, V]) LoadAndDelete

func (s *Sync[K, V]) LoadAndDelete(k K) (V, bool)

func (*Sync[K, V]) LoadOrStore

func (s *Sync[K, V]) LoadOrStore(k K, store V) (V, bool)

func (*Sync[K, V]) Range

func (s *Sync[K, V]) Range(f func(k K, v V) bool)

func (*Sync[K, V]) Store

func (s *Sync[K, V]) Store(k K, v V)

func (*Sync[K, V]) Swap

func (s *Sync[K, V]) Swap(k K, v V) (V, bool)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL