Documentation
¶
Index ¶
- func AddContextFunc(name string, spec string, runImmediately bool, fn Func) error
- func AddFunc(name string, spec string, fn func()) error
- func Every(duration time.Duration) string
- func Parse(spec string) (schedule, error)
- func Remove(name string)
- func RemovePrefix(prefix string)
- func StopAll()
- type Func
- type Manager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddContextFunc ¶
AddContextFunc 按 cron 表达式注册一个任务,支持传递带 context 的 func。
func AddFunc ¶
AddFunc 按 cron 表达式注册一个任务,fn 会在独立 goroutine 中执行。 支持 5 字段、6 字段 cron 表达式,以及 @every 1m 这类固定间隔表达式。
func Parse ¶
Parse 解析 cron 表达式。 支持:
- 5 字段:minute hour day-of-month month day-of-week
- 6 字段:second minute hour day-of-month month day-of-week
- @every 1m / @every 30s
字段支持 *、*/n、a-b、a-b/n、逗号列表和具体数字。
func RemovePrefix ¶
func RemovePrefix(prefix string)
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() *Manager
func (*Manager) AddContextFunc ¶
func (*Manager) RemovePrefix ¶
Click to show internal directories.
Click to hide internal directories.