cmap

package module
v0.0.0-...-4066e12 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 2 Imported by: 3

README

concurrent map

wraps sync.Map adds types and count

m := cmap.New[string, string]()

isNew := m.Set("hello", "world")
value, ok := m.Get("hello")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CMap

type CMap[K, V any] struct {
	sync.Map
	// contains filtered or unexported fields
}

func New

func New[K, V any]() CMap[K, V]

func (*CMap[K, V]) Clear

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

func (*CMap[K, V]) Count

func (m *CMap[K, V]) Count() int64

func (*CMap[K, V]) Delete

func (m *CMap[K, V]) Delete(key K) bool

func (*CMap[K, V]) Get

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

func (*CMap[K, V]) GetOrSet

func (m *CMap[K, V]) GetOrSet(key K, value V) V

func (*CMap[K, V]) Has

func (m *CMap[K, V]) Has(key K) bool

func (*CMap[K, V]) IsEmpty

func (m *CMap[K, V]) IsEmpty() bool

func (*CMap[K, V]) Iter

func (m *CMap[K, V]) Iter() chan Entry[K, V]

func (*CMap[K, V]) Keys

func (m *CMap[K, V]) Keys() chan K

func (*CMap[K, V]) Len

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

func (*CMap[K, V]) Range

func (m *CMap[K, V]) Range(f func(key K, value V) bool)

func (*CMap[K, V]) Remove

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

func (*CMap[K, V]) Set

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

func (*CMap[K, V]) SetIfAbsent

func (m *CMap[K, V]) SetIfAbsent(key K, value V) bool

func (*CMap[K, V]) Values

func (m *CMap[K, V]) Values() chan V

type Entry

type Entry[K, V any] struct {
	Key K
	Val V
}

Jump to

Keyboard shortcuts

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