package
Version:
v0.1.6
Opens a new window with list of versions in this module.
Published: Jul 22, 2025
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
¶
定时任务使用方法
1. 实现Jober接口,注册任务
例如:
// 注册任务
func init() {
timer.RegisterJob(&TestTimer{})
}
// 实现Jober接口
type TestTimer struct {
}
func (t *TestTimer) GetName() string {
return "TestTimer"
}
func (t *TestTimer) GetCron() string {
return "*/1 * * * *"
}
func (t *TestTimer) Run() {
log.Println("TestTimer is run")
}
2. 在入口出引入即可
例: import _ "gintpl/internal/timer"
Documentation
¶
func RegisterJob(job Jober)
RegisterJob 注册任务
Source Files
¶
Click to show internal directories.
Click to hide internal directories.