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: ? 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[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