Documentation ¶ Index ¶ type CronJob func New() *CronJob func (m *CronJob) RegisterTask(tasks ...Task) (err error) func (m *CronJob) Run(tasks ...Task) func (m *CronJob) RunAsync(tasks ...Task) func (m *CronJob) RunSync(tasks ...Task) func (m *CronJob) Stop() type Task type Tasks Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type CronJob ¶ type CronJob struct { Cron *cron.Cron // 暴露原库 API } cron job: cron 表达式: http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/tutorial-lesson-06.html https://en.wikipedia.org/wiki/Cron func New ¶ func New() *CronJob func (*CronJob) RegisterTask ¶ func (m *CronJob) RegisterTask(tasks ...Task) (err error) 注册 task: func (*CronJob) Run ¶ func (m *CronJob) Run(tasks ...Task) 注册和启动分开, 灵活调用位置 func (*CronJob) RunAsync ¶ added in v0.1.8 func (m *CronJob) RunAsync(tasks ...Task) 异步: func (*CronJob) RunSync ¶ added in v0.1.8 func (m *CronJob) RunSync(tasks ...Task) 同步: func (*CronJob) Stop ¶ added in v0.1.8 func (m *CronJob) Stop() stop: type Task ¶ type Task struct { Name string Schedule string // 执行计划周期: cron 表达式 // TaskFunc func() // 任务方法 } 单个任务: type Tasks ¶ type Tasks struct { Task []Task } 一批任务: Source Files ¶ View all Source files cron.go option.go Directories ¶ Show internal Expand all Path Synopsis example Click to show internal directories. Click to hide internal directories.