Documentation ¶
Overview ¶
Package cron
Package cron ¶
Package cron ¶
Package cron 定时任务 ¶
Package cron ¶
Package cron
Index ¶
Constants ¶
View Source
const ( Yearly = "@yearly" Annually = "@annually" Monthly = "@monthly" Daily = "@daily" MidNightly = "@midnight" Hourly = "@hourly" Weekly = "@weekly" Every = "@every" // 后面使用秒s 分m 时h )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cron ¶
type Cron struct {
// contains filtered or unexported fields
}
func NewWithOption ¶ added in v1.0.5
func NewWithOption(ops ...cron.Option) *Cron
NewWithOption 附加原生cron v3配置
func NewWithRecover ¶ added in v1.0.5
func NewWithRecover() *Cron
NewWithRecover 创建带recover的支持秒级的定时器
type CronGroup ¶ added in v1.0.5
type CronGroup struct { Spec string // cronjob规则 // contains filtered or unexported fields }
CronGroup 相同定时的任务组
type ScheduleJob ¶ added in v1.0.6
type ScheduleJob struct { ExecTime time.Time // 执行时间 Name string // 可选 任务名称 // contains filtered or unexported fields }
func NewSchedule ¶ added in v1.0.6
func NewSchedule(t time.Time, f func()) *ScheduleJob
NewSchedule 创建一个计划任务 给定的时间如果在过去或等于现在的时间 不做任何事情
func (*ScheduleJob) IsStopped ¶ added in v1.0.6
func (s *ScheduleJob) IsStopped() bool
IsStopped 是否停止
func (*ScheduleJob) SetName ¶ added in v1.0.6
func (s *ScheduleJob) SetName(name string)
func (*ScheduleJob) Start ¶ added in v1.0.6
func (s *ScheduleJob) Start()
func (*ScheduleJob) Stop ¶ added in v1.0.6
func (s *ScheduleJob) Stop()
Click to show internal directories.
Click to hide internal directories.