cron

package
v0.0.1-beta.3 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2022 License: GPL-2.0 Imports: 3 Imported by: 0

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
}

func New

func New() *Cron

New cron job controller

func (*Cron) AddJobs

func (c *Cron) AddJobs(jobs ...*Job) error

AddJobs adds job to cron controller, error if controller can't parse schedule

func (*Cron) MustAddJobs

func (c *Cron) MustAddJobs(jobs ...*Job)

MustAddJobs same as AddJobs but panic if error

func (*Cron) Run

func (c *Cron) Run(ctx context.Context) error

Run starts all added jobs and wait for context

type Job

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

func NewJob

func NewJob(shedule string, f func()) *Job

NewJob adds new cron job with shedule in format of cron '* * * * * *' where 'second minute hour dayOfMonth month dayOfWeek'

Jump to

Keyboard shortcuts

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