Help us shape the future of Go! Take the 2026 Go Developer Survey

syncmap

package
v1.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 1 Imported by: 0

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 type-safe wrapper around sync.Map that eliminates type assertions at call sites.

A Map must not be copied after first use.

func (*Map[K, V]) Delete

func (s *Map[K, V]) Delete(key K)

Delete removes the value for key.

func (*Map[K, V]) Load

func (s *Map[K, V]) Load(key K) (V, bool)

Load returns the stored value for key.

func (*Map[K, V]) LoadAndDelete

func (s *Map[K, V]) LoadAndDelete(key K) (V, bool)

LoadAndDelete deletes the value for key and returns it if present.

func (*Map[K, V]) LoadOrStore

func (s *Map[K, V]) LoadOrStore(key K, value V) (V, bool)

LoadOrStore returns the existing value for the key if present.

func (*Map[K, V]) Range

func (s *Map[K, V]) Range(f func(key K, value V) bool)

Range calls f sequentially for each key and value present in the map.

func (*Map[K, V]) Store

func (s *Map[K, V]) Store(key K, value V)

Store saves value under key.

Jump to

Keyboard shortcuts

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