Documentation ¶
Overview ¶
Package gocron is scheduled task library.
Index ¶
- Variables
- func DeleteTask(name string)
- func EveryHour(size int) string
- func EveryMinute(size int) string
- func EverySecond(size int) string
- func Everyday(size int) string
- func GetRunningTasks() []string
- func Init(opts ...Option) error
- func IsRunningTask(name string) bool
- func Run(tasks ...*Task) error
- func Stop()
- type Option
- type Task
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SecondType = 0 MinuteType = 1 )
Functions ¶
func GetRunningTasks ¶
func GetRunningTasks() []string
GetRunningTasks gets a list of running task names
func IsRunningTask ¶
IsRunningTask determine if the task is running
Types ¶
type Option ¶
type Option func(*options)
Option set the cron options.
func WithGranularity ¶ added in v1.10.0
WithGranularity set log
type Task ¶
type Task struct { // seconds (0-59) minutes (0- 59) hours (0-23) days (1-31) months (1-12) weeks (0-6) // "*/5 * * * * *" means every five seconds. // "0 15,45 9-12 * * * " indicates execution at the 15th and 45th minutes from 9 a.m. to 12 a.m. each day TimeSpec string Name string // task name Fn func() // task function IsRunOnce bool // if the task is only run once }
Task scheduled task
Click to show internal directories.
Click to hide internal directories.