sync

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package sync provides parametrized Map implementation

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 typed wrapper of sync.Map

func NewMap

func NewMap[K comparable, V any]() Map[K, V]

NewMap sync Map constructor

func (*Map[K, V]) Delete

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

Delete removes value by their keys from the map

func (*Map[K, V]) DeleteOne

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

DeleteOne removes an value by the key from the map

func (*Map[K, V]) Get

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

Get returns the value for a key. If ok==false, then the map does not contain the key.

func (*Map[K, V]) Remove

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

Remove removes value by key and return it

func (*Map[K, V]) Set

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

Set sets the value for a key

func (*Map[K, V]) TrackEach

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

TrackEach applies the 'tracker' function for every key/value pairs

Jump to

Keyboard shortcuts

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