generic

package
v1.1.0-beta.0...-3047328 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncMap

type SyncMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

SyncMap is the generic version of the sync.Map.

func NewSyncMap

func NewSyncMap[K comparable, V any](capacity int) SyncMap[K, V]

NewSyncMap returns a new SyncMap.

func (*SyncMap[K, V]) Delete

func (m *SyncMap[K, V]) Delete(key K) (val V, exist bool)

Delete deletes the value for a key, returning the previous value if any. The exist result reports whether the key was present.

func (*SyncMap[K, V]) Keys

func (m *SyncMap[K, V]) Keys() []K

Keys returns all the keys in the map.

func (*SyncMap[K, V]) Load

func (m *SyncMap[K, V]) Load(key K) (V, bool)

Load loads a key value.

func (*SyncMap[K, V]) Store

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

Store stores a value.

Jump to

Keyboard shortcuts

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