1 Star 0 Fork 0

庞飞/multiapp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
schedule_command.go 1.38 KB
一键复制 编辑 原始数据 按行查看 历史
庞飞 提交于 2023-10-03 10:28 . 合并主框架
package cmd
import (
"fmt"
"gitee.com/pangxianfei/multiapp/cmd/schedule"
)
type ScheduleCommand struct {
commandHandler func(arg *Arg) error
arg *Arg
when schedule.When
}
func newScheduleCommand(handler func(arg *Arg) error, arg *Arg) *ScheduleCommand {
return &ScheduleCommand{commandHandler: handler, arg: arg}
}
func (sc *ScheduleCommand) Yearly() {
sc.when = schedule.EveryYear
}
func (sc *ScheduleCommand) Monthly() {
sc.when = schedule.EveryMonth
}
func (sc *ScheduleCommand) Daily() {
sc.when = schedule.EveryDay
}
func (sc *ScheduleCommand) Hourly() {
sc.when = schedule.EveryHour
}
func (sc *ScheduleCommand) EveryMinute() {
sc.when = schedule.EveryMinute
}
func (sc *ScheduleCommand) EverySecond() {
sc.when = schedule.EverySecond
}
func (sc *ScheduleCommand) EveryDays(d uint) {
sc.when = fmt.Sprintf(schedule.EveryHoursFormat, d*24)
}
func (sc *ScheduleCommand) EveryHours(h uint) {
sc.when = fmt.Sprintf(schedule.EveryHoursFormat, h)
}
func (sc *ScheduleCommand) EveryMinutes(m uint) {
sc.when = fmt.Sprintf(schedule.EveryMinutesFormat, m)
}
func (sc *ScheduleCommand) EverySeconds(s uint) {
sc.when = fmt.Sprintf(schedule.EverySecondsFormat, s)
}
func (sc *ScheduleCommand) When() schedule.When {
return sc.when
}
func (sc *ScheduleCommand) args() *Arg {
return sc.arg
}
func (sc *ScheduleCommand) handler() func(arg *Arg) error {
return sc.commandHandler
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/pangxianfei/multiapp.git
git@gitee.com:pangxianfei/multiapp.git
pangxianfei
multiapp
multiapp
v1.1.8

搜索帮助

0d507c66 1850385 C8b1a773 1850385