schedule

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid = errors.New("invalid")
	ErrRange   = errors.New("not in range")
)
View Source
var (
	ErrDone = errors.New("done")
)
View Source
var Separator = ";"

Functions

This section is empty.

Types

type Runner

type Runner interface {
	Run(context.Context) error
}

func DelayRunner

func DelayRunner(r Runner, wait time.Duration) Runner

func DoAfter

func DoAfter(r Runner, do func(error) error) Runner

func DoBefore

func DoBefore(r Runner, do func() error) Runner

func LimitRunning

func LimitRunning(r Runner, max int) Runner

func SkipRunning

func SkipRunning(r Runner) Runner

func Trace

func Trace(r Runner, name string) Runner

type Scheduler

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

func Schedule

func Schedule(min, hour, day, month, week string) (*Scheduler, error)

func ScheduleFromList

func ScheduleFromList(ls []string) (*Scheduler, error)

func (*Scheduler) Next

func (s *Scheduler) Next() time.Time

func (*Scheduler) Now

func (s *Scheduler) Now() time.Time

func (*Scheduler) Reset

func (s *Scheduler) Reset(when time.Time)

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context, r Runner) error

func (*Scheduler) RunFunc

func (s *Scheduler) RunFunc(ctx context.Context, fn func(context.Context) error) error

type Ticker

type Ticker interface {
	Curr() int
	Next()
	By(int)

	All() bool
	// contains filtered or unexported methods
}

func All

func All(min, max int) Ticker

func Interval

func Interval(from, to, min, max int) Ticker

func List

func List(es []Ticker) Ticker

func Parse

func Parse(cron string, min, max int, names []string) (Ticker, error)

func Single

func Single(base, min, max int) Ticker

Jump to

Keyboard shortcuts

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