Documentation
¶
Index ¶
- type ErrorHandlerGetter
- type LocationGetter
- type LogLevel
- type LogLevelGetter
- type LogWriterGetter
- type Logger
- type LoggerGetter
- type Option
- func WithConfigurator(i interface{}) Option
- func WithErrorHandler(handler func(error)) Option
- func WithErrorHandlerSetter(s ErrorHandlerGetter) Option
- func WithLocation(loc *time.Location) Option
- func WithLocationSetter(s LocationGetter) Option
- func WithLogLevel(level LogLevel) Option
- func WithLogLevelSetter(s LogLevelGetter) Option
- func WithLogWriter(writer io.Writer) Option
- func WithLogWriterSetter(s LogWriterGetter) Option
- func WithLogger(logger Logger) Option
- func WithLoggerSetter(s LoggerGetter) Option
- func WithParser(p Parser) Option
- func WithParserSetter(s ParserGetter) Option
- type Parser
- type ParserGetter
- type Scheduler
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorHandlerGetter ¶ added in v0.1.0
type ErrorHandlerGetter interface {
GetErrorHandler() func(error)
}
type LocationGetter ¶ added in v0.1.0
type LogLevelGetter ¶ added in v0.1.0
type LogLevelGetter interface {
GetLogLevel() LogLevel
}
type LogWriterGetter ¶ added in v0.1.0
type LoggerGetter ¶ added in v0.1.0
type LoggerGetter interface {
GetLogger() Logger
}
type Option ¶
type Option func(*Scheduler)
Option defines the functional option type for CronScheduler
func WithConfigurator ¶ added in v0.1.0
func WithConfigurator(i interface{}) Option
WithConfigurator sets multiple options from a single configuration struct that implements one or more Getter interfaces
func WithErrorHandler ¶
WithErrorHandler sets a custom error handler for the scheduler
func WithErrorHandlerSetter ¶ added in v0.1.0
func WithErrorHandlerSetter(s ErrorHandlerGetter) Option
func WithLocation ¶
WithLocation sets the timezone location for the scheduler
func WithLocationSetter ¶ added in v0.1.0
func WithLocationSetter(s LocationGetter) Option
func WithLogLevelSetter ¶ added in v0.1.0
func WithLogLevelSetter(s LogLevelGetter) Option
func WithLogWriter ¶
WithLogWriter sets a custom writer for logging
func WithLogWriterSetter ¶ added in v0.1.0
func WithLogWriterSetter(s LogWriterGetter) Option
func WithLogger ¶
WithLogger sets a custom logger for the scheduler
func WithLoggerSetter ¶ added in v0.1.0
func WithLoggerSetter(s LoggerGetter) Option
func WithParser ¶
WithParser sets the type of cron expression parser to use
func WithParserSetter ¶ added in v0.1.0
func WithParserSetter(s ParserGetter) Option
type ParserGetter ¶ added in v0.1.0
type ParserGetter interface {
GetParser() Parser
}
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler wraps cron functionality
func NewScheduler ¶
NewScheduler creates a new scheduler instance with the provided options TODO: Move to scheduler.NewCron()?
func (*Scheduler) AddHandler ¶
func (s *Scheduler) AddHandler(opts command.HandlerConfig, handler any) (Subscription, error)
AddHandler registers a handler for scheduled execution It accepts any handler type that implements the Message interface and returns an entryID that can be used to remove the job later
- handler: func()
- handler: func() error
- handler: command.Commander[T]
- handler: command.CommandFunc[T]
func (*Scheduler) RemoveHandler ¶
RemoveHandler removes a scheduled job by its entry ID
type Subscription ¶
type Subscription interface {
Unsubscribe()
}
func AddCommand ¶
func AddCommand[T any](s *Scheduler, opts command.HandlerConfig, handler command.CommandFunc[T]) (Subscription, error)
AddCommand is a type-safe way to add command handlers