selector

package
v0.0.0-...-0372559 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolSelector

type BoolSelector interface {
	Random() bool
	WithProbability(probability float64) bool
}

func NewBoolSelector

func NewBoolSelector() BoolSelector

type BoolSelectorImpl

type BoolSelectorImpl struct{}

func (*BoolSelectorImpl) Random

func (b *BoolSelectorImpl) Random() bool

func (*BoolSelectorImpl) WithProbability

func (b *BoolSelectorImpl) WithProbability(probability float64) bool

type DateSelector

type DateSelector interface {
	Before(moment time.Time, period time.Duration) time.Time
	BeforeNow(after time.Time) time.Time
	After(moment time.Time, period time.Duration) time.Time
	Between(start, end time.Time) time.Time
}

func NewDateSelector

func NewDateSelector() DateSelector

type DateSelectorImpl

type DateSelectorImpl struct{}

func (*DateSelectorImpl) After

func (d *DateSelectorImpl) After(moment time.Time, period time.Duration) time.Time

func (*DateSelectorImpl) Before

func (d *DateSelectorImpl) Before(moment time.Time, period time.Duration) time.Time

func (*DateSelectorImpl) BeforeNow

func (d *DateSelectorImpl) BeforeNow(after time.Time) time.Time

func (*DateSelectorImpl) Between

func (d *DateSelectorImpl) Between(start, end time.Time) time.Time

type SliceSelector

type SliceSelector interface {
	Random(length int) int
	Exponential(length int) int
}

func NewSliceSelector

func NewSliceSelector() SliceSelector

type SliceSelectorImpl

type SliceSelectorImpl struct{}

func (*SliceSelectorImpl) Exponential

func (s *SliceSelectorImpl) Exponential(length int) int

func (*SliceSelectorImpl) Random

func (s *SliceSelectorImpl) Random(length int) int

Jump to

Keyboard shortcuts

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