Documentation ¶
Index ¶
- type Schedule
- type Scheduler
- func (s *Scheduler) Cancel(uuid string) error
- func (s *Scheduler) Clear()
- func (s *Scheduler) Crons() (L []*models.Cron, err error)
- func (s *Scheduler) RunAfter(duration time.Duration, name string, params ...string) (string, error)
- func (s *Scheduler) RunAt(when time.Time, name string, params ...string) (string, error)
- func (s *Scheduler) RunEvery(interval time.Duration, name string, params ...string) (string, error)
- func (s *Scheduler) Start() error
- func (s *Scheduler) Stop()
- func (s *Scheduler) Wait()
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Schedule ¶
type Schedule struct { IsRecurring bool LastRun time.Time NextRun time.Time Interval time.Duration }
Schedule 保存任务执行时间相关的信息
type Scheduler ¶
Scheduler 用于调度任务,它保存了待执行任务的相关信息
func (*Scheduler) Cancel ¶
Cancel is used to cancel the planned execution of a specific task using it's ID. The ID is returned when the task was scheduled using RunAt, RunAfter or RunEvery
type Task ¶
type Task struct { Schedule Name string UUID string Cmd string Status string IsRunning bool Params []string sync.Mutex }
Task holds information about task
func NewTaskWithSchedule ¶
NewTaskWithSchedule creates an instance of task with the provided schedule information
Click to show internal directories.
Click to hide internal directories.