cron

package
v3.37.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

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

Clock give time

func (*Clock) Now

func (c *Clock) Now() time.Time

Now return current time

type Cron

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

Cron definition

func New

func New() *Cron

New creates new cron

func (*Cron) At

func (c *Cron) At(hour string) *Cron

At sets hour of run in format HH:MM

func (*Cron) Clock

func (c *Cron) Clock(clock *Clock) *Cron

Clock sets clock that give current time, mostly for testing purpose

func (*Cron) Days

func (c *Cron) Days() *Cron

Days sets recurence to every day

func (*Cron) Each

func (c *Cron) Each(interval time.Duration) *Cron

Each sets interval of each run

func (*Cron) Friday

func (c *Cron) Friday() *Cron

Friday sets recurence to every Friday

func (*Cron) In

func (c *Cron) In(tz string) *Cron

In sets timezone

func (*Cron) MaxRetry

func (c *Cron) MaxRetry(maxRetry uint) *Cron

MaxRetry sets maximum retry count

func (*Cron) Monday

func (c *Cron) Monday() *Cron

Monday sets recurence to every Monday

func (*Cron) Now

func (c *Cron) Now() *Cron

Now run cron now

func (*Cron) OnError added in v3.37.0

func (c *Cron) OnError(onError func(error)) *Cron

OnError defines error handling function

func (*Cron) OnSignal added in v3.37.0

func (c *Cron) OnSignal(signal os.Signal) *Cron

OnSignal sets signal listened for trigerring cron

func (*Cron) Retry

func (c *Cron) Retry(retryInterval time.Duration) *Cron

Retry sets interval retry if action failed

func (*Cron) Saturday

func (c *Cron) Saturday() *Cron

Saturday sets recurence to every Saturday

func (*Cron) Shutdown added in v3.37.0

func (c *Cron) Shutdown()

Shutdown cron, do not attempt Start() after

func (*Cron) Start

func (c *Cron) Start(action func(time.Time) error, done <-chan struct{})

Start cron

func (*Cron) String

func (c *Cron) String() string

func (*Cron) Sunday

func (c *Cron) Sunday() *Cron

Sunday sets recurence to every Sunday

func (*Cron) Thursday

func (c *Cron) Thursday() *Cron

Thursday sets recurence to every Thursday

func (*Cron) Tuesday

func (c *Cron) Tuesday() *Cron

Tuesday sets recurence to every Tuesday

func (*Cron) Wednesday

func (c *Cron) Wednesday() *Cron

Wednesday sets recurence to every Wednesday

func (*Cron) Weekdays

func (c *Cron) Weekdays() *Cron

Weekdays sets recurence to every day except sunday and saturday

Jump to

Keyboard shortcuts

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