Documentation
¶
Index ¶
- type Map
- func (m *Map[K, V]) Delete(key K)
- func (m *Map[K, V]) Load(key K) (value V, ok bool)
- func (m *Map[K, V]) LoadAndDelete(key K) (value V, loaded bool)
- func (m *Map[K, V]) LoadOrStore(key K, value V) (actual V, loaded bool)
- func (m *Map[K, V]) Range(f func(key K, value V) bool)
- func (m *Map[K, V]) Store(key K, value V)
- type Mutex
- type Pool
- type RWMutex
- type Value
- type WaitGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
Map is a generic version of sync.Map More info sees https://pkg.go.dev/sync#Map
func (*Map[K, V]) Load ¶
Load returns the value stored in the map for a key, or zero value of T if no value is present. The ok result indicates whether value was found in the map.
func (*Map[K, V]) LoadAndDelete ¶
LoadAndDelete deletes the value for a key, returning the previous value if any. The loaded result reports whether the key was present.
func (*Map[K, V]) LoadOrStore ¶
LoadOrStore returns the existing value for the key if present. Otherwise, it stores and returns the given value. The loaded result is true if the value was loaded, false if stored.
func (*Map[K, V]) Range ¶
Range calls f sequentially for each key and value present in the map. If f returns false, range stops the iteration. More info sees https://pkg.go.dev/sync#Map.Range
type Mutex ¶
Mutex is reexport sync.Mutex for easy use. More info sees https://pkg.go.dev/sync#Mutex
type Pool ¶
type Pool[T any] struct { New func() T // contains filtered or unexported fields }
Pool is a generic version of sync.Pool More info sees https://pkg.go.dev/sync#Pool
func (*Pool[T]) Get ¶
Get selects an arbitrary item from the pool, removes it from the pool, and returns it to the caller. The ok result indicates whether value was found in the pool. It returns (zero value of T, false) if there has nothing in the pool.
type RWMutex ¶
RWMutex is reexport sync.RWMutex for easy use. More info sees https://pkg.go.dev/sync#RWMutex
type Value ¶
type Value[T any] struct { // contains filtered or unexported fields }
Value is a generic version of atomic.Value More info sees https://pkg.go.dev/sync/atomic#Value
func (*Value[T]) CompareAndSwap ¶
CompareAndSwap executes the compare-and-swap operation for the Value[T]. It will panic if T is not an comparable type.
func (*Value[T]) Load ¶
Load returns the value set by the most recent Store. It returns (zero value of T, false) if there has been no call to Store for this Value.
type WaitGroup ¶
WaitGroup is reexport sync.WaitGroup for easy use. More info sees https://pkg.go.dev/sync#WaitGroup