Documentation ¶
Index ¶
- Constants
- Variables
- type Scheduler
- func (s *Scheduler) Clear()
- func (s *Scheduler) DisableTaskByID(id int) error
- func (s *Scheduler) EnableTaskByID(id int) error
- func (s *Scheduler) GetDisableTasks() []*Task
- func (s *Scheduler) GetEnableTasks() []*Task
- func (s *Scheduler) GetTasks() []*Task
- func (s *Scheduler) NewScheduleTask(id int, name string, action func(v ...interface{}), signal chan int, ...) error
- func (s *Scheduler) RemoveTaskByID(id int) error
- func (s *Scheduler) RunAsync()
- type Task
Constants ¶
View Source
const (
SIGTASKTERM = 0x1
)
Goroutine task signals
Variables ¶
View Source
var ( //ErrorBadTimeFormat is rise when time format is bad for example create a task that run at 52 hour ErrorBadTimeFormat error = errors.New("Bad Time Format") //ErrorTaskNotFound rised when no task found in the scheduler ErrorTaskNotFound error = errors.New("Task not found in the scheduler") )
Functions ¶
This section is empty.
Types ¶
type Scheduler ¶
type Scheduler struct { Tasks []*Task UpdateInterval int WarningLogger *log.Logger InfoLogger *log.Logger ErrorLogger *log.Logger }
Scheduler represent the scheduler
func NewScheduler ¶
NewScheduler is constructor of scheduler
func (*Scheduler) DisableTaskByID ¶
DisableTaskByID disable task on the scheduler but don't delete it
func (*Scheduler) EnableTaskByID ¶
EnableTaskByID enable a task that has been disabled
func (*Scheduler) GetDisableTasks ¶
GetDisableTasks return disable task
func (*Scheduler) GetEnableTasks ¶
GetEnableTasks return enabled task
func (*Scheduler) GetTasks ¶
GetTasks return all task managed by scheduler
func (*Scheduler) NewScheduleTask ¶
func (s *Scheduler) NewScheduleTask(id int, name string, action func(v ...interface{}), signal chan int, hour, minute, second int) error
NewScheduleTask create a new schedule task and add it in the scheduler
func (*Scheduler) RemoveTaskByID ¶
RemoveTaskByID remove task in the scheduler by it's ID
Click to show internal directories.
Click to hide internal directories.