Documentation
¶
Overview ¶
Package cron provides a cron-like job scheduler.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job represents a scheduled task in the scheduler.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages a collection of jobs and ensures they are run at the scheduled times.
func NewScheduler ¶
func NewScheduler() *Scheduler
NewScheduler creates and returns a new Scheduler. It immediately starts the scheduling goroutine.
func (*Scheduler) AddJob ¶
AddJob adds a new job to the scheduler. The schedule should be a cron-like string with five fields: minute, hour, day of month, month, and day of week. It returns a pointer to the created Job and an error if the schedule is invalid.
func (*Scheduler) RemoveJob ¶
RemoveJob removes a job from the scheduler. If the job is not in the scheduler (i.e., has already been removed), this operation is a no-op.