go get com.github/finnlee87/go-job-lite
execute db/init.sql in mysql db.
func main() {
jobEngine := engine.Default()
jobEngine.Register(ExampleJob{})
jobEngine.Run()
ch := make(chan string)
<-ch
}
Job must implement BaseJob
type ExampleJob struct {
}
func (example ExampleJob) Name() string {
return "example-job"
}
func (example ExampleJob) Cron() string {
return "0/1 * * * * * *"
}
func (example ExampleJob) Execute() error {
lib.Logger.Infoln("example job run.")
return nil
}