Documentation
¶
Overview ¶
Package threadsafe contains data structures (like maps) that can be safely used by multiple goroutines at the same time.
Index ¶
- func Foreach[E any](concurrencyLimit int, collection []E, f func(E))
- type Map
- func (m *Map[K, V]) Delete(key K)
- func (m *Map[K, V]) DeleteUnsafe(key K)
- func (m *Map[K, V]) Get(key K) (val V, ok bool)
- func (m *Map[K, V]) GetUnsafe(key K) (val V, ok bool)
- func (m *Map[K, V]) Len() int
- func (m *Map[K, V]) Lock()
- func (m *Map[K, V]) Set(key K, value V)
- func (m *Map[K, V]) SetUnsafe(key K, value V)
- func (m *Map[K, V]) Unlock()
- type Set
- type Slice
- func (s *Slice[V]) Append(values ...V)
- func (s *Slice[V]) AppendUnsafe(values ...V)
- func (s *Slice[V]) Cap() int
- func (s *Slice[V]) Get(index int) (val V, ok bool)
- func (s *Slice[V]) GetUnsafe(index int) (val V, ok bool)
- func (s *Slice[V]) Len() int
- func (s *Slice[V]) Push(val V)
- func (s *Slice[V]) PushUnsafe(val V)
- func (s *Slice[V]) Set(index int, val V) (ok bool)
- func (s *Slice[V]) SetUnsafe(index int, val V) (ok bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Map ¶
type Map[K comparable, V any] struct { Map map[K]V // contains filtered or unexported fields }
func NewMap ¶
func NewMap[K comparable, V any]() *Map[K, V]
func NewMapWithValues ¶
func NewMapWithValues[K comparable, V any](m map[K]V) *Map[K, V]
func (*Map[K, V]) DeleteUnsafe ¶
func (m *Map[K, V]) DeleteUnsafe(key K)
type Set ¶
type Set[V comparable] struct { Map map[V]struct{} // contains filtered or unexported fields }
func NewSet ¶
func NewSet[V comparable]() *Set[V]
func NewSetWithValues ¶
func NewSetWithValues[V comparable](m map[V]struct{}) *Set[V]
func (*Set[V]) ContainsUnsafe ¶
func (*Set[V]) RemoveUnsafe ¶
func (s *Set[V]) RemoveUnsafe(val V)
type Slice ¶
type Slice[V any] struct { Slice []V // contains filtered or unexported fields }
func NewSliceWithValues ¶
func (*Slice[V]) AppendUnsafe ¶
func (s *Slice[V]) AppendUnsafe(values ...V)
func (*Slice[V]) PushUnsafe ¶
func (s *Slice[V]) PushUnsafe(val V)
Click to show internal directories.
Click to hide internal directories.