resolve

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Everytime

type Everytime struct{}

Everytime always resolves to zero, as a constantly occurring resolver.

func (Everytime) Resolve

func (s Everytime) Resolve(_ int) int

Resolve returns the distance to the next occurrence, as unit values.

type FixedSchedule

type FixedSchedule struct {
	Max int
	At  int
}

FixedSchedule resolves on a specific value, described as At. It also stores Max to delimit the maximum range for this resolver.

func (FixedSchedule) Resolve

func (s FixedSchedule) Resolve(value int) int

Resolve returns the distance to the next occurrence, as unit values.

type RangeSchedule

type RangeSchedule struct {
	Max  int
	From int
	To   int
}

RangeSchedule resolves on every value between From and To. It also stores Max to delimit the maximum range for this resolver.

func (RangeSchedule) Resolve

func (s RangeSchedule) Resolve(value int) int

Resolve returns the distance to the next occurrence, as unit values.

type StepSchedule

type StepSchedule struct {
	Max   int
	Steps []int
}

StepSchedule resolves on specific values listed in Steps. It also stores Max to delimit the maximum range for this resolver.

func NewStepSchedule

func NewStepSchedule(from, to, maximum, frequency int) StepSchedule

NewStepSchedule is a constructor to quickly build StepSchedule types, using key values to create the steps -- using from and to delimiters as well as the resolver's maximum value, and a frequency.

func (StepSchedule) Resolve

func (s StepSchedule) Resolve(value int) int

Resolve returns the distance to the next occurrence, as unit values.

Jump to

Keyboard shortcuts

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