Documentation
¶
Index ¶
- type Scheduler
- func (s *Scheduler) Add(task *Task)
- func (s *Scheduler) Cron(expression string, name string, handler TaskHandler)
- func (s *Scheduler) Daily(timeStr string, name string, handler TaskHandler)
- func (s *Scheduler) Every(duration time.Duration, name string, handler TaskHandler)
- func (s *Scheduler) Hourly(minute int, name string, handler TaskHandler)
- func (s *Scheduler) List() []*Task
- func (s *Scheduler) Start(ctx context.Context)
- func (s *Scheduler) Stop()
- type Task
- type TaskHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages scheduled tasks
func (*Scheduler) Cron ¶
func (s *Scheduler) Cron(expression string, name string, handler TaskHandler)
Cron schedules a task using cron expression
func (*Scheduler) Daily ¶
func (s *Scheduler) Daily(timeStr string, name string, handler TaskHandler)
Daily schedules a task to run daily at specific time (HH:MM format)
func (*Scheduler) Every ¶
func (s *Scheduler) Every(duration time.Duration, name string, handler TaskHandler)
Every schedules a task to run at fixed intervals
type Task ¶
type Task struct {
Name string
Schedule string // Cron expression or interval
Handler TaskHandler
LastRun time.Time
NextRun time.Time
Enabled bool
}
Task represents a scheduled task
type TaskHandler ¶
TaskHandler is a function that executes a scheduled task
Click to show internal directories.
Click to hide internal directories.