maps

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: GPL-3.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentMap

type ConcurrentMap struct {
	// contains filtered or unexported fields
}

ConcurrentMap is a thread safe map of type string:Anything. To avoid lock bottlenecks this map is divided to several map chunks.

func NewConcurrentMap

func NewConcurrentMap(nChunks uint32) *ConcurrentMap

NewConcurrentMap creates a new concurrent map.

func (*ConcurrentMap) Clear

func (m *ConcurrentMap) Clear()

Clear clears the map

func (*ConcurrentMap) Count

func (m *ConcurrentMap) Count() int

Count returns the number of elements within the map

func (*ConcurrentMap) Get

func (m *ConcurrentMap) Get(key string) (interface{}, bool)

Get retrieves an element from map under given key.

func (*ConcurrentMap) Has

func (m *ConcurrentMap) Has(key string) bool

Has looks up an item under specified key.

func (*ConcurrentMap) IterCb

func (m *ConcurrentMap) IterCb(fn IterCb)

IterCb iterates over the map (cheapest way to read all elements in a map)

func (*ConcurrentMap) Keys

func (m *ConcurrentMap) Keys() []string

Keys returns all keys as []string

func (*ConcurrentMap) Remove

func (m *ConcurrentMap) Remove(key string) (interface{}, bool)

Remove removes an element from the map.

func (*ConcurrentMap) Set

func (m *ConcurrentMap) Set(key string, value interface{})

Set sets the given value under the specified key.

func (*ConcurrentMap) SetIfAbsent

func (m *ConcurrentMap) SetIfAbsent(key string, value interface{}) bool

SetIfAbsent sets the given value under the specified key if no value was associated with it.

type IterCb

type IterCb func(key string, v interface{})

IterCb is an iterator callback

Jump to

Keyboard shortcuts

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