Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTaskAlreadyExists = errors.New("task already exists") ErrTaskNotFound = errors.New("task not found") ErrIntervalTimeoutBothSet = errors.New("only one of Interval or Timeout must be set") ErrIntervalTimeoutNoneSet = errors.New("either Interval or Timeout must be set") ErrTaskFuncNotSet = errors.New("TaskFunc must be set") ErrIntervalDurationTooShort = errors.New("interval duration must be greater than 1 second") ErrTimeoutDurationTooShort = errors.New("timeout duration must be greater than 1 second") ErrSchedulerRunning = errors.New("scheduler is already running") ErrSchedulerNotRunning = errors.New("scheduler is not running") )
Functions ¶
This section is empty.
Types ¶
type Scheduler ¶
type TaskDefinition ¶
type TaskOptions ¶
type TaskOptions struct {
// Interval is the time between each task run.
// Timeout OR Interval must be set.
Interval time.Duration
// Timeout is the maximum time the task is allowed to run
// before it is forcefully stopped.
// Timeout OR Interval must be set.
Timeout time.Duration
// Overwrite indicates whether to overwrite the task if it already exists.
// If set to false, an error will be returned if the task already exists.
// If set to true, the task will be overwritten with the new task and any existing timers will be reset.
Overwrite bool
// TaskFunc is the function to run when the task is scheduled.
TaskFunc TaskFunc
}
Click to show internal directories.
Click to hide internal directories.