maps

package
v2.13.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

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

func SortedKeys[M ~map[K]V, K cmp.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, n 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