container

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 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 Iterator

type Iterator[Elem any] struct {
	// contains filtered or unexported fields
}

Iterator 是一个迭代器, 它能按照你自己设置的规则返回每一次的数据 它的实现不是goroutine安全的

func NewIterator

func NewIterator[Elem any](tail int, forward bool, iterate func(current int) Elem, reset func()) *Iterator[Elem]

func (*Iterator[Elem]) Forward

func (iter *Iterator[Elem]) Forward() (Elem, bool)

func (*Iterator[Elem]) Index

func (iter *Iterator[Elem]) Index(i int) (Elem, bool)

func (*Iterator[Elem]) Next

func (iter *Iterator[Elem]) Next() bool

func (*Iterator[Elem]) Reset

func (iter *Iterator[Elem]) Reset()

func (*Iterator[Elem]) Tail

func (iter *Iterator[Elem]) Tail() int

func (*Iterator[Elem]) Take

func (iter *Iterator[Elem]) Take() Elem

type MutexMap

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

func (*MutexMap[Key, Value]) Clean

func (m *MutexMap[Key, Value]) Clean() map[Key]Value

func (*MutexMap[Key, Value]) Delete

func (m *MutexMap[Key, Value]) Delete(k Key)

func (*MutexMap[Key, Value]) Len

func (m *MutexMap[Key, Value]) Len() int

func (*MutexMap[Key, Value]) Load

func (m *MutexMap[Key, Value]) Load(k Key) Value

func (*MutexMap[Key, Value]) LoadOk

func (m *MutexMap[Key, Value]) LoadOk(k Key) (Value, bool)

func (*MutexMap[Key, Value]) Range

func (m *MutexMap[Key, Value]) Range(fn func(key Key, v Value) bool)

func (*MutexMap[Key, Value]) Store

func (m *MutexMap[Key, Value]) Store(k Key, v Value)

type RCUDeleteNode

type RCUDeleteNode[Val any] struct {
	Value Val
	Ok    bool
}

type RCUMap

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

RCUMap 这个Map的实现只适合少量key-value, 或者几乎无写的场景 在大量key-value时拷贝数据的开销很大

func NewRCUMap

func NewRCUMap[K comparable, V any]() *RCUMap[K, V]

func (*RCUMap[Key, Val]) Delete

func (R *RCUMap[Key, Val]) Delete(key Key)

func (*RCUMap[Key, Val]) DeleteMulti

func (R *RCUMap[Key, Val]) DeleteMulti(keys []Key) []RCUDeleteNode[Val]

func (*RCUMap[Key, Val]) DeleteOk

func (R *RCUMap[Key, Val]) DeleteOk(key Key) (Val, bool)

func (*RCUMap[Key, Val]) Len

func (R *RCUMap[Key, Val]) Len() int

func (*RCUMap[Key, Val]) LoadOk

func (R *RCUMap[Key, Val]) LoadOk(key Key) (Val, bool)

func (*RCUMap[Key, Val]) Range

func (R *RCUMap[Key, Val]) Range(fn func(key Key, val Val) bool)

func (*RCUMap[Key, Val]) Store

func (R *RCUMap[Key, Val]) Store(key Key, val Val)

func (*RCUMap[Key, Val]) StoreMulti

func (R *RCUMap[Key, Val]) StoreMulti(kvs []RCUMapElement[Key, Val])

type RCUMapElement

type RCUMapElement[Key comparable, Val any] struct {
	Key   Key
	Value Val
}

type RWMutexMap

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

func (*RWMutexMap[Key, Value]) Delete

func (m *RWMutexMap[Key, Value]) Delete(k Key)

func (*RWMutexMap[Key, Value]) Len

func (m *RWMutexMap[Key, Value]) Len() int

func (*RWMutexMap[Key, Value]) Load

func (m *RWMutexMap[Key, Value]) Load(k Key) Value

func (*RWMutexMap[Key, Value]) LoadOk

func (m *RWMutexMap[Key, Value]) LoadOk(k Key) (Value, bool)

func (*RWMutexMap[Key, Value]) Store

func (m *RWMutexMap[Key, Value]) Store(k Key, v Value)

type Slice

type Slice[V comparable] []V

func (*Slice[V]) Append

func (s *Slice[V]) Append(v []V)

func (*Slice[V]) AppendS

func (s *Slice[V]) AppendS(vs ...V)

func (*Slice[V]) Cap

func (s *Slice[V]) Cap() int

func (*Slice[V]) Len

func (s *Slice[V]) Len() int

func (*Slice[V]) Reset

func (s *Slice[V]) Reset()

func (*Slice[V]) Unique

func (s *Slice[V]) Unique()

type SliceMap

type SliceMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewSliceMap

func NewSliceMap[K comparable, V any](size int) *SliceMap[K, V]

func (*SliceMap[K, V]) Cap

func (m *SliceMap[K, V]) Cap() int

func (*SliceMap[K, V]) Delete

func (m *SliceMap[K, V]) Delete(key K)

func (*SliceMap[K, V]) Len

func (m *SliceMap[K, V]) Len() int

func (*SliceMap[K, V]) Load

func (m *SliceMap[K, V]) Load(key K) V

func (*SliceMap[K, V]) LoadOk

func (m *SliceMap[K, V]) LoadOk(key K) (V, bool)

func (*SliceMap[K, V]) Range

func (m *SliceMap[K, V]) Range(fn func(K, V) (next bool))

func (*SliceMap[K, V]) Reset

func (m *SliceMap[K, V]) Reset()

func (*SliceMap[K, V]) Store

func (m *SliceMap[K, V]) Store(key K, value V)

type SyncMap118

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

func (*SyncMap118[Key, Value]) Delete

func (s *SyncMap118[Key, Value]) Delete(k Key)

func (*SyncMap118[Key, Value]) Len

func (s *SyncMap118[Key, Value]) Len() int

func (*SyncMap118[Key, Value]) LoadOk

func (s *SyncMap118[Key, Value]) LoadOk(k Key) (Value, bool)

func (*SyncMap118[Key, Value]) Range

func (s *SyncMap118[Key, Value]) Range(fn func(key Key, value Value) bool)

func (*SyncMap118[Key, Value]) Store

func (s *SyncMap118[Key, Value]) Store(k Key, v Value)

Jump to

Keyboard shortcuts

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