common

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Aggregator

type Aggregator[T any, R any] interface {
	Add(T)
	Remove(T)
	Result() R
}

type Comparer

type Comparer[T any] interface {
	Compare(T) int
}

Return negative if less, positive if greater, 0 if equal

type DefaultComparer

type DefaultComparer[T constraints.Ordered] struct {
	Val T
}

func (DefaultComparer[T]) Compare

func (dc DefaultComparer[T]) Compare(other DefaultComparer[T]) int

type DefaultKeyable

type DefaultKeyable[T comparable] struct {
	Val T
}

func (DefaultKeyable[T]) Key

func (dk DefaultKeyable[T]) Key() T

type Keyable

type Keyable[K comparable] interface {
	Key() K
}

type Ticker

type Ticker interface {
	C() <-chan time.Time
	Stop()
}

type TimeComparer

type TimeComparer[T Timed] struct {
	Val T
}

func (TimeComparer[T]) Compare

func (tc TimeComparer[T]) Compare(other TimeComparer[T]) int

type TimeProvider

type TimeProvider interface {
	Now() time.Time
	NewTicker(d time.Duration) Ticker
	NewTimer(d time.Duration) Timer
	After(d time.Duration) <-chan time.Time
	AfterFunc(d time.Duration, f func()) Timer
	Sleep(d time.Duration)
	Since(d time.Time) time.Duration
}

func NewRealTimeProvider

func NewRealTimeProvider() TimeProvider

type Timed

type Timed interface {
	Time() time.Time
}

type Timer

type Timer interface {
	C() <-chan time.Time
	Stop()
}

Jump to

Keyboard shortcuts

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