async

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentMap

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

func (*ConcurrentMap[K, V]) AddAll

func (cf *ConcurrentMap[K, V]) AddAll(entries map[K]V)

func (*ConcurrentMap[K, V]) Compute

func (cf *ConcurrentMap[K, V]) Compute(k K, computeFunc func(k K, v V) (val V, ok bool))

Compute sets the value of key 'k' to the result of the supplied computeFunc. If the value of 'ok' is 'false', the entry for key 'k' will be removed from the ConcurrentMap.

func (*ConcurrentMap[K, V]) Delete

func (cf *ConcurrentMap[K, V]) Delete(k K) (v V, existed bool)

func (*ConcurrentMap[K, V]) Each

func (cf *ConcurrentMap[K, V]) Each(f func(k K, v V) (stop bool))

Each executes `f` for each key-value pair in the map, while holding the lock. ! Avoid doing expensive operations in `f`, instead create a copy (eg via `Entries()`).

func (*ConcurrentMap[K, V]) Entries

func (cf *ConcurrentMap[K, V]) Entries() []MapEntry[K, V]

func (*ConcurrentMap[K, V]) Get

func (cf *ConcurrentMap[K, V]) Get(k K) (v V, ok bool)

func (*ConcurrentMap[K, V]) Keys

func (cf *ConcurrentMap[K, V]) Keys() []K

func (*ConcurrentMap[K, V]) Len

func (cf *ConcurrentMap[K, V]) Len() int

func (*ConcurrentMap[K, V]) Set

func (cf *ConcurrentMap[K, V]) Set(k K, v V)

func (*ConcurrentMap[K, V]) Values

func (cf *ConcurrentMap[K, V]) Values() []V

type MapEntry

type MapEntry[K comparable, V any] struct {
	Key   K
	Value V
}

Jump to

Keyboard shortcuts

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