hotgo/server/internal/crons/test.go

34 lines
655 B
Go
Raw Normal View History

2022-11-24 23:37:34 +08:00
// Package crons
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
2022-11-24 23:37:34 +08:00
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package crons
import (
"context"
"hotgo/internal/library/cron"
2022-11-24 23:37:34 +08:00
"time"
)
func init() {
cron.Register(Test)
}
// Test 测试任务(无参数)
2022-11-24 23:37:34 +08:00
var Test = &cTest{name: "test"}
type cTest struct {
name string
}
func (c *cTest) GetName() string {
return c.name
}
// Execute 执行任务
func (c *cTest) Execute(ctx context.Context, parser *cron.Parser) (err error) {
parser.Logger.Infof(ctx, "cron test Execute:%v", time.Now())
return
2022-11-24 23:37:34 +08:00
}