feat(cron): add cron scheduler

This commit is contained in:
hexxa 2022-05-24 19:53:36 +08:00 committed by Hexxa
parent 0dfa09033e
commit 0962ddb57c
4 changed files with 32 additions and 12 deletions

19
src/cron/wrapper.go Normal file
View file

@ -0,0 +1,19 @@
package cron
import cronv3 "github.com/robfig/cron/v3"
type ICron interface {
AddFun(spec string, cmd func()) error
Start()
Stop()
}
type MyCron struct {
*cronv3.Cron
}
func NewMyCron() *MyCron {
return &MyCron{
Cron: cronv3.New(),
}
}