Documentation ¶
Index ¶
- type Map
- func (slf *Map[Key, Value]) Atom(handle func(m hash.Map[Key, Value]))
- func (slf *Map[Key, Value]) AtomGetSet(key Key, handle func(value Value, exist bool) (newValue Value, isSet bool))
- func (slf *Map[Key, Value]) Clear()
- func (slf *Map[Key, Value]) ClearHandle(handle func(key Key, value Value))
- func (slf *Map[Key, Value]) Delete(key Key)
- func (slf *Map[Key, Value]) DeleteExist(key Key) bool
- func (slf *Map[Key, Value]) DeleteGet(key Key) Value
- func (slf *Map[Key, Value]) DeleteGetExist(key Key) (Value, bool)
- func (slf *Map[Key, Value]) Exist(key Key) bool
- func (slf *Map[Key, Value]) Get(key Key) Value
- func (slf *Map[Key, Value]) GetExist(key Key) (Value, bool)
- func (slf *Map[Key, Value]) GetOne() (value Value)
- func (slf *Map[Key, Value]) Keys() []Key
- func (slf *Map[Key, Value]) Map() map[Key]Value
- func (slf *Map[Key, Value]) MarshalJSON() ([]byte, error)
- func (slf *Map[Key, Value]) Range(handle func(key Key, value Value))
- func (slf *Map[Key, Value]) RangeBreakout(handle func(key Key, value Value) bool)
- func (slf *Map[Key, Value]) RangeFree(handle func(key Key, value Value, skip func(), breakout func()))
- func (slf *Map[Key, Value]) RangeSkip(handle func(key Key, value Value) bool)
- func (slf *Map[Key, Value]) Set(key Key, value Value)
- func (slf *Map[Key, Value]) Size() int
- func (slf *Map[Key, Value]) Slice() []Value
- func (slf *Map[Key, Value]) UnmarshalJSON(bytes []byte) error
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]) AtomGetSet ¶
func (slf *Map[Key, Value]) AtomGetSet(key Key, handle func(value Value, exist bool) (newValue Value, isSet bool))
AtomGetSet 原子方式获取一个值并在之后进行赋值
func (*Map[Key, Value]) ClearHandle ¶
func (slf *Map[Key, Value]) ClearHandle(handle func(key Key, value Value))
func (*Map[Key, Value]) DeleteExist ¶
func (*Map[Key, Value]) DeleteGetExist ¶
func (*Map[Key, Value]) MarshalJSON ¶
func (*Map[Key, Value]) Range ¶
func (slf *Map[Key, Value]) Range(handle func(key Key, value Value))
func (*Map[Key, Value]) RangeBreakout ¶
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]) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.