Documentation
¶
Index ¶
- type MapSync
- func (t *MapSync[K, V]) Copy(key K) map[K]V
- func (t *MapSync[K, V]) Empty() bool
- func (t *MapSync[K, V]) Get(key K) (V, bool)
- func (t *MapSync[K, V]) GetOrSet(key K, value V) (V, bool)
- func (t *MapSync[K, V]) GetOrSetFunc(key K, fn func() V) (V, bool)
- func (t *MapSync[K, V]) Insert(key K, value V)
- func (t *MapSync[K, V]) IteratorAsc(visitor visitor.KvVisitor[K, V])
- func (t *MapSync[K, V]) IteratorDesc(visitor visitor.KvVisitor[K, V])
- func (t *MapSync[K, V]) Keys() []K
- func (t *MapSync[K, V]) LockFunc(fn func(m map[K]V))
- func (t *MapSync[K, V]) Remove(key K) (V, bool)
- func (t *MapSync[K, V]) Set(key K, value V)
- func (t *MapSync[K, V]) Size() int
- func (t *MapSync[K, V]) Vals() []V
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MapSync ¶
type MapSync[K comparable, V any] struct { Map map[K]V Lock sync.Locker }
gosync "sync"
func (*MapSync[K, V]) Get ¶
Find finds the first node that the key is equal to the passed key, and returns its value
func (*MapSync[K, V]) GetOrSetFunc ¶ added in v1.3.7
func (*MapSync[K, V]) Insert ¶
func (t *MapSync[K, V]) Insert(key K, value V)
Insert inserts a key-value pair into the RbTree.
func (*MapSync[K, V]) IteratorAsc ¶
IteratorDesc traversals elements in the RbTree, it will not stop until to the end of RbTree or the visitor returns false
func (*MapSync[K, V]) IteratorDesc ¶
IteratorDesc traversals elements in the RbTree, it will not stop until to the end of RbTree or the visitor returns false
func (*MapSync[K, V]) LockFunc ¶ added in v1.3.5
func (t *MapSync[K, V]) LockFunc(fn func(m map[K]V))
type Option ¶
type Option func(option *Options)
Option is a function type used to set Options
func WithGoroutineSafe ¶
func WithGoroutineSafe() Option
WithGoroutineSafe is used to set the set goroutine-safe Note that iterators are not goroutine safe, and it is useless to turn on the setting option here. so don't use iterators in multi goroutines