generic

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SyncMap

type SyncMap[K comparable, V any] struct {
	Mu deadlock.RWMutex
	//Mu   sync.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(v V) 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(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