Documentation ¶
Overview ¶
*
- @Author: kwens
- @Date: 2022-10-09 17:39:09
- @Description:
*
- @Author: kwens
- @Date: 2022-09-02 09:42:47
- @Description:
*
- @Author: kwens
- @Date: 2022-10-10 09:35:03
- @Description:
Index ¶
- Constants
- Variables
- func New() *cron
- func Start()
- type CronExpr
- type CronExprOption
- func With24TimeStr(timestr string) []CronExprOption
- func WithCustom(custom []int, position Position) CronExprOption
- func WithEvery(position Position) CronExprOption
- func WithInterval(begin, sep int, position Position) CronExprOption
- func WithLastDay() CronExprOption
- func WithLastWeek(weekDay int) CronExprOption
- func WithNearWorkDay(day int) CronExprOption
- func WithNoDesignate(position Position) CronExprOption
- func WithRange(begin, end int, position Position) CronExprOption
- type Position
- type PositionLimit
Constants ¶
View Source
const ( SPEC_ZERO_TIME = "0 0 0 * * *" // 每天凌晨0点 SPEC_ZERO_AFTER_15MIN_TIME = "0 15 0 * * *" // 每天凌晨0点15分 )
Variables ¶
View Source
var (
Cron *cron
)
Functions ¶
Types ¶
type CronExpr ¶
type CronExpr struct {
// contains filtered or unexported fields
}
func NewCronExpr ¶
func NewCronExpr() *CronExpr
func (*CronExpr) Gen ¶
Gen 生成表达式 如果某个位置的表达式条件不适用规则,则默认返回“*”,比如在min位置适用WithNoDesignate 如果传入的表达式条件为范围值,当不符合范围要求时,直接报错
func (*CronExpr) SetCondition ¶
func (ce *CronExpr) SetCondition(opts ...CronExprOption) error
SetCondition 设置表达式条件,同个位置的条件只会生效最后一个
type CronExprOption ¶
type CronExprOption interface {
// contains filtered or unexported methods
}
func With24TimeStr ¶
func With24TimeStr(timestr string) []CronExprOption
With24TimeStr 24小时制的时间设置,eg: 12:20:00
func WithEvery ¶
func WithEvery(position Position) CronExprOption
func WithInterval ¶
func WithInterval(begin, sep int, position Position) CronExprOption
func WithLastWeek ¶
func WithLastWeek(weekDay int) CronExprOption
WithLastWeek 本月最后一个星期几 @param.weekDay: 1-7
func WithNearWorkDay ¶
func WithNearWorkDay(day int) CronExprOption
WithNearWorkDay 每月几号最近的工作日 @param.day: 1-31
func WithNoDesignate ¶
func WithNoDesignate(position Position) CronExprOption
WithNoDesignate 不指定,只有日/星期有, 传入其他位置则返回nil
func WithRange ¶
func WithRange(begin, end int, position Position) CronExprOption
type PositionLimit ¶
type PositionLimit []int
Click to show internal directories.
Click to hide internal directories.