Documentation ¶
Index ¶
- Variables
- type AddJobConfig
- type AddJobOption
- type Config
- type Cron
- func (c *Cron) AddDailyJob(id string, cmd func() error) (err error)
- func (c *Cron) AddHourlyJob(id string, cmd func() error) (err error)
- func (c *Cron) AddJob(id string, spec string, job func() error, opts ...AddJobOption) error
- func (c *Cron) AddMinutelyJob(id string, cmd func() error) (err error)
- func (c *Cron) AddMonthlyJob(id string, cmd func() error) (err error)
- func (c *Cron) AddSecondlyJob(id string, cmd func() error) (err error)
- func (c *Cron) AddWeeklyJob(id string, cmd func() error) (err error)
- func (c *Cron) AddYearlyJob(id string, cmd func() error) (err error)
- func (c *Cron) Clear() (err error)
- func (c *Cron) ClearJobs() (err error)
- func (c *Cron) HasJob(id string) bool
- func (c *Cron) Length() int
- func (c *Cron) RemoveJob(id string) (err error)
- func (c *Cron) Restart() (err error)
- func (c *Cron) Start() (err error)
- func (c *Cron) Stop() (err error)
Constants ¶
This section is empty.
Variables ¶
var Version = "1.2.3"
Version is the current version of cron.
Functions ¶
This section is empty.
Types ¶
type AddJobConfig ¶ added in v1.2.2
type AddJobConfig struct { // RunRightNow specifies whether to run the job immediately after adding it. RunRightNow bool }
AddJobConfig is a configuration for AddJob.
type AddJobOption ¶ added in v1.2.2
type AddJobOption func(cfg *AddJobConfig)
AddJobOption is a function that configures the AddJob.
type Config ¶
type Config struct { // TimeZone is the timezone in which the cron will run. TimeZone string // RunNow specifies whether to run the job immediately after adding it. RunRightNow bool }
Config is a wrapper of robCron.Config
type Cron ¶
Cron is a schedule job, which can be used to run jobs on a schedule.
func (*Cron) AddDailyJob ¶
AddDailyJob adds a schedule job run in every day.
func (*Cron) AddHourlyJob ¶
AddHourlyJob adds a schedule job run in every hour.
func (*Cron) AddMinutelyJob ¶
AddMinutelyJob adds a schedule job run in every minute.
func (*Cron) AddMonthlyJob ¶
AddMonthlyJob adds a schedule job run in every month.
func (*Cron) AddSecondlyJob ¶
AddSecondlyJob adds a schedule job run in every second.
func (*Cron) AddWeeklyJob ¶
AddWeeklyJob adds a schedule job run in every week.
func (*Cron) AddYearlyJob ¶
AddYearlyJob adds a schedule job run in every year.
func (*Cron) RemoveJob ¶ added in v1.1.0
RemoveJob removes a Job from the Cron to be run on the given schedule.