asynchronization

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[Key comparable, Value any] struct {
	// contains filtered or unexported fields
}

Map 非并发安全的字典数据结构

  • 可用于对 synchronization.Map 的替代

func NewMap

func NewMap[Key comparable, value any]() *Map[Key, value]

func (*Map[Key, Value]) Atom

func (slf *Map[Key, Value]) Atom(handle func(m hash.Map[Key, Value]))

Atom 原子操作

func (*Map[Key, Value]) AtomGetSet

func (slf *Map[Key, Value]) AtomGetSet(key Key, handle func(value Value, exist bool) (newValue Value, isSet bool))

AtomGetSet 原子方式获取一个值并在之后进行赋值

func (*Map[Key, Value]) Clear

func (slf *Map[Key, Value]) Clear()

func (*Map[Key, Value]) ClearHandle

func (slf *Map[Key, Value]) ClearHandle(handle func(key Key, value Value))

func (*Map[Key, Value]) Delete

func (slf *Map[Key, Value]) Delete(key Key)

func (*Map[Key, Value]) DeleteExist

func (slf *Map[Key, Value]) DeleteExist(key Key) bool

func (*Map[Key, Value]) DeleteGet

func (slf *Map[Key, Value]) DeleteGet(key Key) Value

func (*Map[Key, Value]) DeleteGetExist

func (slf *Map[Key, Value]) DeleteGetExist(key Key) (Value, bool)

func (*Map[Key, Value]) Exist

func (slf *Map[Key, Value]) Exist(key Key) bool

func (*Map[Key, Value]) Get

func (slf *Map[Key, Value]) Get(key Key) Value

func (*Map[Key, Value]) GetExist

func (slf *Map[Key, Value]) GetExist(key Key) (Value, bool)

func (*Map[Key, Value]) GetOne

func (slf *Map[Key, Value]) GetOne() (value Value)

GetOne 获取一个

func (*Map[Key, Value]) Keys

func (slf *Map[Key, Value]) Keys() []Key

func (*Map[Key, Value]) Map

func (slf *Map[Key, Value]) Map() map[Key]Value

func (*Map[Key, Value]) MarshalJSON

func (slf *Map[Key, Value]) MarshalJSON() ([]byte, error)

func (*Map[Key, Value]) Range

func (slf *Map[Key, Value]) Range(handle func(key Key, value Value))

func (*Map[Key, Value]) RangeBreakout

func (slf *Map[Key, Value]) RangeBreakout(handle func(key Key, value Value) bool)

func (*Map[Key, Value]) RangeFree

func (slf *Map[Key, Value]) RangeFree(handle func(key Key, value Value, skip func(), breakout func()))

func (*Map[Key, Value]) RangeSkip

func (slf *Map[Key, Value]) RangeSkip(handle func(key Key, value Value) bool)

func (*Map[Key, Value]) Set

func (slf *Map[Key, Value]) Set(key Key, value Value)

func (*Map[Key, Value]) Size

func (slf *Map[Key, Value]) Size() int

func (*Map[Key, Value]) Slice

func (slf *Map[Key, Value]) Slice() []Value

func (*Map[Key, Value]) UnmarshalJSON

func (slf *Map[Key, Value]) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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