Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const ( //RegisterTypeCron 0 cron 表达式类型 例子 :"*/5 * * * *" RegisterTypeCron = iota //RegisterTypeTime 1 特定时间 例子: "2022-10-11 12:12" 精确到分 RegisterTypeTime )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { AppConf dto.AppConf ScheduleConf dto.ScheduleConf }
func (*Client) RegisterCorn ¶
func (c *Client) RegisterCorn(input dto.ScheduleRegisterInput) error
RegisterCorn 表达式类型定时任务 例子 :"*/1 * * * *"
Example ¶
conf := dto.AppConf{ ServiceName: "test", Token: "example", } spiderman, _ := spiderman2.NewSpiderman(conf) schedule, _ := spiderman.Schedule(dto.ScheduleConf{ BaseUri: "http://127.0.0.1:8081", CallbackUri: "http://127.0.0.1:8080", }) _ = schedule.RegisterCorn(dto.ScheduleRegisterInput{ ScheduleId: "test-talent", ScheduleName: "ttttt", CallbackParams: nil, Value: "*/1 * * * *", })
Output:
func (*Client) RegisterCornTime ¶
func (c *Client) RegisterCornTime(input dto.ScheduleRegisterInput) error
RegisterCornTime 特定时间定时任务
Example ¶
conf := dto.AppConf{ ServiceName: "test", Token: "example", } spiderman, _ := spiderman2.NewSpiderman(conf) schedule, _ := spiderman.Schedule(dto.ScheduleConf{ BaseUri: "http://127.0.0.1:8081", CallbackUri: "http://127.0.0.1:8080", }) _ = schedule.RegisterCornTime(dto.ScheduleRegisterInput{ ScheduleId: "test-talent", ScheduleName: "ttttt", CallbackParams: nil, Value: "2022-01-01 12:01", })
Output:
func (*Client) RegisterHandler ¶
RegisterHandler 注册回调路由
type ScheduleInterface ¶
type ScheduleInterface interface { RegisterCorn(input dto.ScheduleRegisterInput) error //RegisterCorn 表达式类型定时任务 例子 :"*/1 * * * *" RegisterCornTime(input dto.ScheduleRegisterInput) error //RegisterCornTime 特定时间定时任务 RegisterHandler(r *gin.Engine, f gin.HandlerFunc, relativePath string) error //RegisterHandler 注册回调路由 UnRegister(scheduleId string) error //UnRegister 取消定时任务 }
ScheduleInterface support pipelining using the RegisterCorn, RegisterCornTime, RegisterHandler and UnRegister methods
func NewClient ¶
func NewClient(conf dto.AppConf, scheduleConf dto.ScheduleConf) ScheduleInterface
The NewClient interface is the primary interface for working with ScheduleInterface
Click to show internal directories.
Click to hide internal directories.