cron

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EVERY    = iota // Run the task every minInterval
	HOURLY          // Run the task every hour. At minInterval(<60 Minutes) after the hour
	DAILY           // Run the task every day. At minInterval(<24 Hours) after 00:00
	WEEKDAYS        // Run the task every weekday. At minInterval(<24 Hours) after 00:00
	WEEKEND         // Run the task everyweekend. At minInterval(<48Hours) after 00:00
)

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, cronTab *CronTab)

Run runs cronTab.Job repeatedly, until the context is cancelled..

func Trigger

func Trigger(cronTab *CronTab) (err error)

Trigger triggers a crontab immediately.

Types

type CronTab

type CronTab struct {
	Name     string                          // Name of the job
	Time     time.Duration                   // Min inteval between triggers
	TrigType DurationType                    // Refer to the const above for available options
	Job      func(ctx context.Context) error // Target routine to trigger
	// contains filtered or unexported fields
}

CronTab describes the job to be run by cron

type DurationType

type DurationType int

Jump to

Keyboard shortcuts

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