syncmap

package
v0.0.0-...-14fd01d Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package syncmap provides a concurrent map implementation using parameterized types.

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
}

The Map type wraps a map within a sync.RWMutex.

func New

func New[K comparable, V any]() *Map[K, V]

New returns a new Map.

func (*Map[K, V]) Clear

func (m *Map[K, V]) Clear()

Clear all entries within the Map.

func (*Map[K, V]) Get

func (m *Map[K, V]) Get(k K) (V, bool)

Get a value from the Map. The boolean return value indicates if a value was found.

func (*Map[K, V]) Keys

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

Keys returns a slice of all keys within the Map.

func (*Map[K, V]) Len

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

Len returns the number of entries within the Map.

func (*Map[K, V]) Put

func (m *Map[K, V]) Put(k K, v V)

Put a value into the Map.

func (*Map[K, V]) Range

func (m *Map[K, V]) Range() iter.Seq2[K, V]

Range over all keys and values in the Map.

func (*Map[K, V]) Remove

func (m *Map[K, V]) Remove(k K)

Remove an entry from the Map.

func (*Map[K, V]) Values

func (m *Map[K, V]) Values() []V

Values returns a slice of all values within the Map.

Jump to

Keyboard shortcuts

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