cron

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package cron 实现了 cron 表达式的 schedulers.Scheduler 接口

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(spec string, loc *time.Location) (schedulers.Scheduler, error)

Parse 根据 spec 初始化 schedulers.Scheduler

spec 表示 crontab 的格式

区分大小写,支持秒,其格式如下:

! * * * * * *
  | | | | | |
  | | | | | --- 星期
  | | | | ----- 月
  | | | ------- 日
  | | --------- 小时
  | ----------- 分
  ------------- 秒

星期与日若同时存在,则以或的形式组合。!用于使 go fmt 不会自动格式化内容,无实际意义。

支持以下符号:

  • - 表示范围
  • , 表示和

同时支持以下便捷指令:

@reboot:   启动时执行一次
@yearly:   0 0 0 1 1 *
@annually: 0 0 0 1 1 *
@monthly:  0 0 0 1 * *
@weekly:   0 0 0 * * 0
@daily:    0 0 0 * * *
@midnight: 0 0 0 * * *
@hourly:   0 0 * * * *

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL