syncmap

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 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 SyncMap

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

SyncMap is a thread-safe map.

func NewSyncMap

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

NewSyncMap creates a new SyncMap.

func (*SyncMap[K, V]) Delete

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

Delete deletes a value from the map.

func (*SyncMap[K, V]) Has

func (s *SyncMap[K, V]) Has(key K) bool

Has returns true if the key exists in the map.

func (*SyncMap[K, V]) Len

func (s *SyncMap[K, V]) Len() int

Len returns the length of the map.

func (*SyncMap[K, V]) Load

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

Load loads a value from the map.

func (*SyncMap[K, V]) Range

func (s *SyncMap[K, V]) Range(callback func(key K, value V) bool)

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

func (*SyncMap[K, V]) Store

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

Store stores a value in the map.

func (*SyncMap[K, V]) ToMap

func (s *SyncMap[K, V]) ToMap() map[K]V

ToMap returns a copy of the map.

Jump to

Keyboard shortcuts

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