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

syncx

package
v0.113.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 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 concurrent map with comparable keys and any values.

func (*Map[K, V]) CompareAndDelete added in v0.105.20

func (m *Map[K, V]) CompareAndDelete(key K, old V) bool

CompareAndDelete deletes the entry for key only if its current value equals old. The stored value must be comparable (e.g. a pointer), or this panics.

func (*Map[K, V]) Delete

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

Delete deletes the value for a key.

func (*Map[K, V]) Len

func (m *Map[K, V]) Len() int

Len returns the number of elements in the map.

func (*Map[K, V]) Load

func (m *Map[K, V]) Load(key K) (value V, ok bool)

Load returns the value for a key if it exists.

func (*Map[K, V]) LoadOrStore

func (m *Map[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)

LoadOrStore loads or stores the value for a key.

func (*Map[K, V]) Range

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

Range calls f sequentially for each key and value present in the map. If f returns false, the range stops.

func (*Map[K, V]) Store

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

Store sets the value for a key.

Jump to

Keyboard shortcuts

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