cron

package
v4.46.4 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 10 Imported by: 7 modules, 7 packages

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 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) 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) Exclusive added in v4.6.0

func (c *Cron) Exclusive(semaphoreApp Semaphore, name string, timeout time.Duration) *Cron

Exclusive runs cron in an exclusive manner with a distributed lock on Redis.

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

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

OnError defines error handling function.

func (*Cron) OnSignal

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

func (c *Cron) Shutdown()

Shutdown cron, do not attempt Start() after.

func (*Cron) Start

func (c *Cron) Start(action func(context.Context) 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.

func (*Cron) WithTracer added in v4.37.0

func (c *Cron) WithTracer(tracer trace.Tracer) *Cron

WithTracer starts a span on each context.

type Semaphore added in v4.29.5

type Semaphore interface {
	Exclusive(context.Context, string, time.Duration, func(context.Context) error) (bool, error)
}

Semaphore client.

Jump to

Keyboard shortcuts

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