From 41bfdea63bf4776bab33c3f6882315e8f15884ac Mon Sep 17 00:00:00 2001 From: what Date: Mon, 30 Oct 2023 15:00:33 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/cron.go | 18 ++++++++++++++++++ cron.go | 15 +++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 base/cron.go create mode 100644 cron.go 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 +}