Documentation
¶
Index ¶
- type JobExistsError
- type JobManager
- func (jm *JobManager) AddJob(jobName string, schedule string, cmd cron.Job) (cron.EntryID, error)
- func (jm *JobManager) GetJobs() map[string]cron.EntryID
- func (jm *JobManager) JobExists(jobName string) bool
- func (jm *JobManager) RemoveJob(jobName string) error
- func (jm *JobManager) Start()
- func (jm *JobManager) Stop() context.Context
- func (jm *JobManager) UpdateJob(jobName string, schedule string, cmd cron.Job) error
- type JobNotFoundError
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobExistsError ¶
type JobExistsError struct {
JobName string
}
JobExistsError represents an error when a job already exists.
func (*JobExistsError) Error ¶
func (e *JobExistsError) Error() string
type JobManager ¶
type JobManager struct {
// contains filtered or unexported fields
}
JobManager manages cron jobs.
func NewJobManager ¶
func NewJobManager(opts ...Option) *JobManager
NewJobManager creates a new instance of JobManager.
func (*JobManager) AddJob ¶
func (jm *JobManager) AddJob(jobName string, schedule string, cmd cron.Job) (cron.EntryID, error)
AddJob adds a new cron job to the manager.
func (*JobManager) GetJobs ¶
func (jm *JobManager) GetJobs() map[string]cron.EntryID
GetJobs returns a map of all the current cron jobs.
func (*JobManager) JobExists ¶
func (jm *JobManager) JobExists(jobName string) bool
JobExists checks if a specific job exists in the manager.
func (*JobManager) RemoveJob ¶
func (jm *JobManager) RemoveJob(jobName string) error
RemoveJob removes a specified cron job from the manager.
func (*JobManager) Start ¶
func (jm *JobManager) Start()
Start starts the cron scheduler to begin executing jobs.
func (*JobManager) Stop ¶
func (jm *JobManager) Stop() context.Context
Stop stops the cron scheduler.
type JobNotFoundError ¶
type JobNotFoundError struct {
JobName string
}
JobNotFoundError represents an error when a job does not exist.
func (*JobNotFoundError) Error ¶
func (e *JobNotFoundError) Error() string
Error implements the error interface for JobNotFoundError.
Click to show internal directories.
Click to hide internal directories.