Documentation
¶
Overview ¶
Package scheduler provides task scheduling and job management.
Index ¶
- func DefaultJobs() []*models.ScheduledJob
- type Handler
- type Option
- func WithCache(c *cache.RedisCache) Option
- func WithConnectorFactory(factory connector.Factory) Option
- func WithCron(c *cron.Cron) Option
- func WithCronParser(p cron.Parser) Option
- func WithEmailAccountLister(repo emailAccountLister) Option
- func WithEmailHandler(handler connector.Handler) Option
- func WithJobs(jobs []*models.ScheduledJob) Option
- func WithLocation(loc *time.Location) Option
- func WithLogger(l *log.Logger) Option
- func WithReminderHub(h notifications.Hub) Option
- func WithTicketAutoCloser(repo ticketAutoCloser) Option
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultJobs ¶
func DefaultJobs() []*models.ScheduledJob
DefaultJobs returns a cloned copy of the built-in scheduled jobs.
Types ¶
type Handler ¶
type Handler func(context.Context, *models.ScheduledJob) error
Handler executes a scheduled job.
type Option ¶
type Option func(*options)
Option applies configuration to the scheduler service.
func WithCache ¶
func WithCache(c *cache.RedisCache) Option
WithCache injects the Redis/Valkey cache client used for status persistence.
func WithConnectorFactory ¶
WithConnectorFactory overrides the inbound connector factory.
func WithCronParser ¶
WithCronParser allows replacing the cron expression parser.
func WithEmailAccountLister ¶
func WithEmailAccountLister(repo emailAccountLister) Option
WithEmailAccountLister injects the repository used for email polling.
func WithEmailHandler ¶
WithEmailHandler injects the connector.Handler used to process inbound messages.
func WithJobs ¶
func WithJobs(jobs []*models.ScheduledJob) Option
WithJobs registers explicit job definitions instead of defaults.
func WithLocation ¶
WithLocation sets the scheduler timezone location.
func WithLogger ¶
WithLogger injects a custom logger implementation.
func WithReminderHub ¶
func WithReminderHub(h notifications.Hub) Option
WithReminderHub injects a custom reminder hub for dispatching pending reminders.
func WithTicketAutoCloser ¶
func WithTicketAutoCloser(repo ticketAutoCloser) Option
WithTicketAutoCloser injects a custom ticket auto-close repository.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates scheduled job execution.
func NewService ¶
NewService wires a scheduler around the shared database connection.
func (*Service) AddJob ¶
func (s *Service) AddJob(job *models.ScheduledJob) error
AddJob dynamically adds a job to the scheduler. The job's Handler field should match a registered handler name. Can be called after the scheduler has started.
func (*Service) RegisterHandler ¶
RegisterHandler attaches or replaces a handler for the given name. Passing nil removes the handler.