Documentation
¶
Index ¶
- func Run(ctx context.Context) error
- func SetScheduler(s *Scheduler)
- func Stop()
- type Expression
- type Job
- func (j *Job) After(callback func()) *Job
- func (j *Job) AppendOutputTo(filename string) *Job
- func (j *Job) At(time string) *Job
- func (j *Job) Before(callback func()) *Job
- func (j *Job) Between(start, end string) *Job
- func (j *Job) Cron(expression string) *Job
- func (j *Job) Daily() *Job
- func (j *Job) DailyAt(time string) *Job
- func (j *Job) Days(days ...int) *Job
- func (j *Job) EmailOutputTo(email string) *Job
- func (j *Job) Environments(environments ...string) *Job
- func (j *Job) EvenInMaintenanceMode() *Job
- func (j *Job) EveryFifteenMinutes() *Job
- func (j *Job) EveryFiveMinutes() *Job
- func (j *Job) EveryMinute() *Job
- func (j *Job) EveryTenMinutes() *Job
- func (j *Job) EveryThirtyMinutes() *Job
- func (j *Job) Fridays() *Job
- func (j *Job) GetLastRun() time.Time
- func (j *Job) GetName() string
- func (j *Job) GetNextRun() time.Time
- func (j *Job) Hourly() *Job
- func (j *Job) HourlyAt(minute int) *Job
- func (j *Job) IsDue(t time.Time) bool
- func (j *Job) IsRunning() bool
- func (j *Job) Mondays() *Job
- func (j *Job) Monthly() *Job
- func (j *Job) Name(name string) *Job
- func (j *Job) OnFailure(callback func(error)) *Job
- func (j *Job) OnOneServer() *Job
- func (j *Job) OnSuccess(callback func()) *Job
- func (j *Job) Run() error
- func (j *Job) RunInBackground() *Job
- func (j *Job) Saturdays() *Job
- func (j *Job) SendOutputTo(filename string) *Job
- func (j *Job) ShouldRun() bool
- func (j *Job) Skip(callback func() bool) *Job
- func (j *Job) Sundays() *Job
- func (j *Job) Thursdays() *Job
- func (j *Job) Tuesdays() *Job
- func (j *Job) UnlessBetween(start, end string) *Job
- func (j *Job) Wednesdays() *Job
- func (j *Job) Weekdays() *Job
- func (j *Job) Weekends() *Job
- func (j *Job) Weekly() *Job
- func (j *Job) When(callback func() bool) *Job
- func (j *Job) WithoutOverlapping() *Job
- func (j *Job) Yearly() *Job
- type Kernel
- type Logger
- type Manager
- type Schedule
- func (s *Schedule) At(time string) *Schedule
- func (s *Schedule) Cron(expression string) *Schedule
- func (s *Schedule) Daily() *Schedule
- func (s *Schedule) DailyAt(time string) *Schedule
- func (s *Schedule) Days(days ...int) *Schedule
- func (s *Schedule) EveryFifteenMinutes() *Schedule
- func (s *Schedule) EveryFiveMinutes() *Schedule
- func (s *Schedule) EveryMinute() *Schedule
- func (s *Schedule) EveryTenMinutes() *Schedule
- func (s *Schedule) EveryThirtyMinutes() *Schedule
- func (s *Schedule) Fridays() *Schedule
- func (s *Schedule) GetExpression() string
- func (s *Schedule) Hourly() *Schedule
- func (s *Schedule) HourlyAt(minute int) *Schedule
- func (s *Schedule) IsDue(t time.Time) bool
- func (s *Schedule) Mondays() *Schedule
- func (s *Schedule) Monthly() *Schedule
- func (s *Schedule) MonthlyOn(day int, time string) *Schedule
- func (s *Schedule) NextRun(from time.Time) time.Time
- func (s *Schedule) Saturdays() *Schedule
- func (s *Schedule) Sundays() *Schedule
- func (s *Schedule) Thursdays() *Schedule
- func (s *Schedule) Tuesdays() *Schedule
- func (s *Schedule) Wednesdays() *Schedule
- func (s *Schedule) Weekdays() *Schedule
- func (s *Schedule) Weekends() *Schedule
- func (s *Schedule) Weekly() *Schedule
- func (s *Schedule) Yearly() *Schedule
- type Scheduler
- func (s *Scheduler) Add(job *Job) *Job
- func (s *Scheduler) After(callback func()) *Scheduler
- func (s *Scheduler) Before(callback func()) *Scheduler
- func (s *Scheduler) Call(callback func()) *Job
- func (s *Scheduler) Command(command string, args ...string) *Job
- func (s *Scheduler) Jobs() []*Job
- func (s *Scheduler) MaintenanceMode(enabled bool) *Scheduler
- func (s *Scheduler) Run(ctx context.Context) error
- func (s *Scheduler) SetLogger(logger Logger) *Scheduler
- func (s *Scheduler) SetTimezone(tz *time.Location) *Scheduler
- func (s *Scheduler) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Expression ¶
type Expression struct {
// contains filtered or unexported fields
}
Expression represents a parsed cron expression
func ParseExpression ¶
func ParseExpression(expr string) (*Expression, error)
ParseExpression parses a cron expression string
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job represents a scheduled task
func (*Job) AppendOutputTo ¶
AppendOutputTo appends output to a file
func (*Job) EmailOutputTo ¶
EmailOutputTo emails the output (requires mail configuration)
func (*Job) Environments ¶
Environments limits execution to specific environments
func (*Job) EvenInMaintenanceMode ¶
EvenInMaintenanceMode allows job to run in maintenance mode
func (*Job) EveryFifteenMinutes ¶
EveryFifteenMinutes runs the job every fifteen minutes
func (*Job) EveryFiveMinutes ¶
EveryFiveMinutes runs the job every five minutes
func (*Job) EveryTenMinutes ¶
EveryTenMinutes runs the job every ten minutes
func (*Job) EveryThirtyMinutes ¶
EveryThirtyMinutes runs the job every thirty minutes
func (*Job) OnOneServer ¶
OnOneServer ensures job runs on only one server (requires distributed lock)
func (*Job) RunInBackground ¶
RunInBackground runs the command in background
func (*Job) SendOutputTo ¶
SendOutputTo redirects output to a file
func (*Job) UnlessBetween ¶
UnlessBetween prevents execution in a time range
func (*Job) WithoutOverlapping ¶
WithoutOverlapping prevents job overlap
type Kernel ¶
type Kernel struct {
// contains filtered or unexported fields
}
Kernel provides a convenient way to define scheduled tasks for an application
func (*Kernel) Define ¶
func (k *Kernel) Define()
Define is where scheduled tasks should be registered This method should be overridden in the application
type Logger ¶
type Logger interface {
Info(msg string, keysAndValues ...interface{})
Error(msg string, keysAndValues ...interface{})
Debug(msg string, keysAndValues ...interface{})
}
Logger interface for scheduler logging
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages multiple schedulers
func (*Manager) SetDefault ¶
SetDefault sets the default scheduler name
type Schedule ¶
type Schedule struct {
// contains filtered or unexported fields
}
Schedule represents when a job should run
func (*Schedule) EveryFifteenMinutes ¶
EveryFifteenMinutes runs every fifteen minutes
func (*Schedule) EveryFiveMinutes ¶
EveryFiveMinutes runs every five minutes
func (*Schedule) EveryMinute ¶
EveryMinute runs every minute
func (*Schedule) EveryTenMinutes ¶
EveryTenMinutes runs every ten minutes
func (*Schedule) EveryThirtyMinutes ¶
EveryThirtyMinutes runs every thirty minutes
func (*Schedule) GetExpression ¶
GetExpression returns the cron expression
func (*Schedule) Wednesdays ¶
Wednesdays runs on Wednesdays
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler manages and executes scheduled jobs
func (*Scheduler) MaintenanceMode ¶
MaintenanceMode enables or disables maintenance mode
func (*Scheduler) SetTimezone ¶
SetTimezone sets the timezone for the scheduler