Documentation
¶
Index ¶
- type IDTable
- type RWSync
- type Sync
- type SyncMap
- type SyncSlice
- func (s *SyncSlice[T]) Clear()
- func (s *SyncSlice[T]) Copy() []T
- func (s *SyncSlice[T]) Get() []T
- func (s *SyncSlice[T]) GetIndex(index int) T
- func (s *SyncSlice[T]) Set(val []T)
- func (s *SyncSlice[T]) SetIndex(index int, value T)
- func (s *SyncSlice[T]) Size() int
- func (s *SyncSlice[T]) Splice(start int, length int) []T
- type Wrapped
- type WrappedMap
- type WrappedSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IDTable ¶
IDTable is a map with random indexes for jobs and other cases where a random but unique index is required
type RWSync ¶
type RWSync[T any] struct { // contains filtered or unexported fields }
RWSync wraps any value in a RWMutex for safe concurrent use. Unlike Sync, concurrent read access is allowed (so don't use it for things like maps and pointers!)
type Sync ¶
type Sync[T any] struct { // contains filtered or unexported fields }
Sync wraps any value in a mutex for safe concurrent use
type SyncMap ¶
type SyncMap[K comparable, T any] Sync[map[K]T]
SyncMap is a map wrapped in a mutex for safe concurrent use
func NewSyncMap ¶
func NewSyncMap[K comparable, T any]() *SyncMap[K, T]
NewSyncMap creates a new Sync object with an empty map
func (*SyncMap[K, T]) Copy ¶ added in v0.0.3
func (s *SyncMap[K, T]) Copy() map[K]T
Copy returns a shallow copy of the wrapped map
func (*SyncMap[K, T]) DeleteKey ¶
func (s *SyncMap[K, T]) DeleteKey(key K)
DeleteKey removes a key from the wrapped map
func (*SyncMap[K, T]) Get ¶ added in v0.2.1
func (s *SyncMap[K, T]) Get() map[K]T
Get is a wrapper to SyncMap.Copy for compatibility with Wrapped
type SyncSlice ¶ added in v0.2.2
SyncSlice is a lice wrapped in a mutex for safe concurrent use
func NewSyncSlice ¶ added in v0.2.2
NewSyncSlice creates a new Sync object with an empty slice
func (*SyncSlice[T]) Copy ¶ added in v0.2.2
func (s *SyncSlice[T]) Copy() []T
Copy returns a shallow copy of the wrapped slice
func (*SyncSlice[T]) Get ¶ added in v0.2.2
func (s *SyncSlice[T]) Get() []T
Get is a wrapper to SyncSlice.Copy for compatibility with Wrapped
type WrappedMap ¶ added in v0.1.1
type WrappedMap[K comparable, V any] interface { Wrapped[map[K]V] GetKey(K) SetKey(K, V) }