diff --git a/base/cron.go b/base/cron.go new file mode 100644 index 0000000..5e47906 --- /dev/null +++ b/base/cron.go @@ -0,0 +1,18 @@ +package base + +type Cron struct { + Uuid string `db:"uuid"` + Code string `db:"code"` + Name string `db:"name"` + ResourceUuid string `db:"resource_uuid"` + Second string `db:"sec"` + Minute string `db:"min"` + Hour string `db:"hr"` + Day string `db:"day"` + Month string `db:"mo"` + Week string `db:"wk"` + UpdatedAt string `db:"updated_at"` + CreatedAt string `db:"created_at"` +} + +type GetCron func(code string) (Cron, bool) diff --git a/cron.go b/cron.go new file mode 100644 index 0000000..f4484ec --- /dev/null +++ b/cron.go @@ -0,0 +1,15 @@ +package contracts + +import "time" + +type CronService interface { + Start() error + Stop() error + Restart() error +} + +type Cron interface { + Controller + // 任务处理 + Handle(time.Time) error +}