Documentation ¶
Index ¶
- Constants
- func OnOffsetTimeNewDayEvent(name string)
- func OnSystemNewDayEvent(name string)
- func RegOffsetTimeNewDayEvent(ticker *Ticker, name string, offset *offset.Time, trigger bool, ...)
- func RegSystemNewDayEvent(ticker *Ticker, name string, trigger bool, handle SystemNewDayEventHandle)
- type OffsetTimeNewDayEventHandle
- type Option
- type Scheduler
- type SystemNewDayEventHandle
- type Ticker
- func (slf *Ticker) After(name string, after time.Duration, handleFunc interface{}, args ...interface{})
- func (slf *Ticker) GetSchedulers() []string
- func (slf *Ticker) IsStopped(name string) bool
- func (slf *Ticker) Loop(name string, after, interval time.Duration, times int, handleFunc interface{}, ...)
- func (slf *Ticker) Mark() string
- func (slf *Ticker) Release()
- func (slf *Ticker) StopTimer(name string)
- type Timer
Constants ¶
View Source
const ( Forever = -1 // 无限循环 Once = 1 // 一次 Instantly = 0 // 立刻 )
View Source
const (
NoMark = "" // 没有设置标记的定时器
)
Variables ¶
This section is empty.
Functions ¶
func OnOffsetTimeNewDayEvent ¶ added in v0.0.28
func OnOffsetTimeNewDayEvent(name string)
OnOffsetTimeNewDayEvent 偏移时间新的一天事件
func OnSystemNewDayEvent ¶ added in v0.0.28
func OnSystemNewDayEvent(name string)
OnSystemNewDayEvent 系统新的一天事件
func RegOffsetTimeNewDayEvent ¶ added in v0.0.28
func RegOffsetTimeNewDayEvent(ticker *Ticker, name string, offset *offset.Time, trigger bool, handle OffsetTimeNewDayEventHandle)
RegOffsetTimeNewDayEvent 注册偏移时间新的一天事件
- 建议全局注册一个事件后再另行拓展
- 与 RegSystemNewDayEvent 类似,但是触发时间为 offset 时间到达每天的 00:00:00
func RegSystemNewDayEvent ¶ added in v0.0.28
func RegSystemNewDayEvent(ticker *Ticker, name string, trigger bool, handle SystemNewDayEventHandle)
RegSystemNewDayEvent 注册系统新的一天事件
- 建议全局注册一个事件后再另行拓展
- 将特定 name 的定时任务注册到 ticker 中,在系统时间到达每天的 00:00:00 时触发,如果 trigger 为 true,则立即触发一次
Types ¶
type OffsetTimeNewDayEventHandle ¶ added in v0.0.28
type OffsetTimeNewDayEventHandle func()
type SystemNewDayEventHandle ¶ added in v0.0.28
type SystemNewDayEventHandle func()
type Ticker ¶
type Ticker struct {
// contains filtered or unexported fields
}
Ticker 定时器
func (*Ticker) After ¶
func (slf *Ticker) After(name string, after time.Duration, handleFunc interface{}, args ...interface{})
After 设置一个在特定时间后运行一次的调度器
Click to show internal directories.
Click to hide internal directories.