utils

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: AGPL-3.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func BinId

func BinId(x uuid.UUID) []byte

func ChanMonitor

func ChanMonitor(name string, ch interface{}, intvl time.Duration)

func ChanMonitorEmpty

func ChanMonitorEmpty(name string, ch interface{}, intvl time.Duration)

func DbToUuid

func DbToUuid(f interface{}) (uuid.UUID, error)

func GetFromAny added in v0.1.13

func GetFromAny[V any](val any, defaultValue V) V

func GetFromAnyMap added in v0.1.13

func GetFromAnyMap[K comparable, V any](amap map[K]any, key K, defaultValue V) V

func LoadRow

func LoadRow(rows *sql.Rows) (map[string]interface{}, error)

func SpaceTypeFromMap

func SpaceTypeFromMap(parametersMap map[string]interface{}) (uuid.UUID, error)

Types

type SyncMap added in v0.1.1

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

func NewSyncMap added in v0.1.1

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

func (*SyncMap[K, V]) Load added in v0.1.1

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

func (*SyncMap[K, V]) Purge added in v0.1.13

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

func (*SyncMap[K, V]) Remove added in v0.1.1

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

func (*SyncMap[K, V]) Store added in v0.1.1

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

type TAtomBool

type TAtomBool struct {
	// contains filtered or unexported fields
}

func (*TAtomBool) Get

func (b *TAtomBool) Get() bool

func (*TAtomBool) Set

func (b *TAtomBool) Set(value bool)

func (*TAtomBool) Swap

func (b *TAtomBool) Swap(value bool) bool

type TimerFunc added in v0.2.0

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

type TimerSet added in v0.2.0

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

func NewTimerSet added in v0.2.0

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

func (*TimerSet[T]) Set added in v0.2.0

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

func (*TimerSet[T]) Stop added in v0.2.0

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

type Unique added in v0.1.4

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

func NewUnique added in v0.1.4

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

func (Unique[V]) Equals added in v0.1.12

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

func (Unique[V]) Value added in v0.1.4

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

Jump to

Keyboard shortcuts

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