cron

package
v0.0.0-...-17b3017 Latest Latest
Warning

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

Go to latest
Published: May 21, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package cron provides some cron utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(spec string) (cron.Schedule, error)

Parse parses job specification.

Types

type Cron

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

Cron wraps `cron.Cron`.

func New

func New() *Cron

New returns an instance of Cron.

func (*Cron) AddFunc

func (c *Cron) AddFunc(spec string, cmd func()) error

func (*Cron) AddJob

func (c *Cron) AddJob(name, spec string, cmd FuncJob) error

AddJob removes the job with the same name first and adds a new job.

func (*Cron) Entries

func (c *Cron) Entries() []cron.Entry

func (*Cron) HasJob

func (c *Cron) HasJob(name string) bool

HasJob returns whether the given job exists.

func (*Cron) Jobs

func (c *Cron) Jobs() map[string]cron.Entry

Jobs returns a map of job names to job.

func (*Cron) RemoveJob

func (c *Cron) RemoveJob(name string)

RemoveJob remove the job with the given name.

type FuncJob

type FuncJob = cron.FuncJob

FuncJob is alias of `cron.FuncJob`.

Jump to

Keyboard shortcuts

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