generic

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchFn added in v0.4.0

type BatchFn[T any] func(batch []T) error

type BatchItemFn added in v0.4.0

type BatchItemFn[T any] func(item T) error

type Butcher added in v0.4.0

type Butcher[T any] struct {
	// contains filtered or unexported fields
}

func NewButcher added in v0.4.0

func NewButcher[T any](data []T) *Butcher[T]

func (*Butcher[T]) HandleBatchesAsync added in v0.4.0

func (b *Butcher[T]) HandleBatchesAsync(ctx context.Context, batchSize int, batchHandler BatchFn[T]) error

func (*Butcher[T]) HandleBatchesSync added in v0.4.0

func (b *Butcher[T]) HandleBatchesSync(batchSize int, batchHandler BatchFn[T]) error

func (*Butcher[T]) HandleItems added in v0.4.0

func (b *Butcher[T]) HandleItems(ctx context.Context, batchSize int, itemHandler BatchItemFn[T]) error

func (*Butcher[T]) Len added in v0.4.0

func (b *Butcher[T]) Len() int

type SyncMap

type SyncMap[K comparable, V any] struct {
	Mu   deadlock.RWMutex
	Data map[K]V
}

func NewSyncMap

func NewSyncMap[K comparable, V any](size int) *SyncMap[K, V]

func (*SyncMap[K, V]) Filter

func (m *SyncMap[K, V]) Filter(predicateFn func(k K, v V) bool) map[K]V

func (*SyncMap[K, V]) Len

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

func (*SyncMap[K, V]) Load

func (m *SyncMap[K, V]) Load(k K) (V, bool)

func (*SyncMap[K, V]) Map

func (m *SyncMap[K, V]) Map(mapFn func(k K, v V) V) map[K]V

func (*SyncMap[K, V]) Purge

func (m *SyncMap[K, V]) Purge()

func (*SyncMap[K, V]) Remove

func (m *SyncMap[K, V]) Remove(k K) bool

func (*SyncMap[K, V]) Store

func (m *SyncMap[K, V]) Store(k K, v V)

type TimerFunc

type TimerFunc[T comparable] func(key T) error

type TimerSet

type TimerSet[T comparable] struct {
	// contains filtered or unexported fields
}

func NewTimerSet

func NewTimerSet[T comparable]() *TimerSet[T]

func (*TimerSet[T]) Set

func (t *TimerSet[T]) Set(ctx context.Context, key T, delay time.Duration, fn TimerFunc[T])

func (*TimerSet[T]) Stop

func (t *TimerSet[T]) Stop(key T)

func (*TimerSet[T]) StopAll

func (t *TimerSet[T]) StopAll()

type Unique

type Unique[V any] struct {
	// contains filtered or unexported fields
}

func NewUnique

func NewUnique[V any](val V) Unique[V]

func (Unique[V]) Cmp

func (u Unique[V]) Cmp() any

func (Unique[V]) Compare

func (u Unique[V]) Compare(cmp any) bool

func (Unique[V]) Equals

func (u Unique[V]) Equals(unique Unique[V]) bool

func (Unique[V]) Value

func (u Unique[V]) Value() V

Jump to

Keyboard shortcuts

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