Documentation
¶
Index ¶
- type Crontab
- func (c *Crontab) AddTaskFunc(cronName, cronExpression string, func_ interface{}, params ...interface{}) error
- func (c *Crontab) AddTaskFuncFree(callbacks ...func(scheduler Scheduler))
- func (c *Crontab) Clear()
- func (c *Crontab) Len() int
- func (c *Crontab) RemoveJobByTag(tag string)
- func (c *Crontab) RunJobByTag(tag string)
- func (c *Crontab) StartAsync()
- func (c *Crontab) StartBlocking()
- func (c *Crontab) Stop()
- type Scheduler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Crontab ¶
func NewCrontab ¶
func NewCrontab() *Crontab
NewCrontab 初始化一个定时任务 不支持分布式调度,如果要支持分布式调度,建议使用redis锁配合实现
func (*Crontab) AddTaskFunc ¶
func (c *Crontab) AddTaskFunc(cronName, cronExpression string, func_ interface{}, params ...interface{}) error
AddTaskFunc 1.快速添加一个定时任务
func (*Crontab) AddTaskFuncFree ¶
AddTaskFuncFree 2.自由的添加任务 示例可以参考文档 :https://github.com/go-co-op/gocron
func (*Crontab) RemoveJobByTag ¶
RemoveJobByTag 根据标签移除某个任务
Click to show internal directories.
Click to hide internal directories.