Documentation
¶
Index ¶
- Variables
- func After[T any](dur time.Duration) options.Option[model.Node[T]]
- func At[T any](t time.Time) options.Option[model.Node[T]]
- func ErrorCB[T any](cb func(error)) options.Option[Scheduler[T]]
- func EventHeaderCreatedAt() string
- func EventHeaderID() string
- func Every[T any](dur time.Duration) options.Option[model.Node[T]]
- func Header[T any](k, v string) options.Option[model.Node[T]]
- func OutChan[T any](ch chan *model.Event[T]) options.Option[Scheduler[T]]
- func Tag[T any](t string) options.Option[model.Node[T]]
- type Scheduler
- func (s *Scheduler[T]) EmitChan() <-chan *model.Event[T]
- func (s *Scheduler[T]) Schedule(payload T, opts ...options.Option[model.Node[T]]) (*model.Event[T], error)
- func (s *Scheduler[T]) Start(ctx context.Context) error
- func (s *Scheduler[T]) Unschedule(id string) error
- func (s *Scheduler[T]) UnscheduleByHeader(key, value string) error
- func (s *Scheduler[T]) UnscheduleByTag(tag string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotRunning = fmt.Errorf("scheduller is not running") ErrEventNotFound = fmt.Errorf("event for given filter not found") ErrUnexpectedEmptyList = fmt.Errorf("unexpected empty shedule event list") ErrEventWithNoIDHeader = fmt.Errorf("got event with no ID header. It will be generated") )
Functions ¶
func EventHeaderCreatedAt ¶ added in v0.0.2
func EventHeaderCreatedAt() string
Get standart header for event creation time.
Types ¶
type Scheduler ¶
type Scheduler[T any] struct { // contains filtered or unexported fields }
func NewScheduler ¶
Create new scheduler with given opts.
func (*Scheduler[T]) Schedule ¶
func (s *Scheduler[T]) Schedule(payload T, opts ...options.Option[model.Node[T]]) (*model.Event[T], error)
Schedule new event. Scheduler must be started to call this method properly.
func (*Scheduler[T]) Unschedule ¶
Unschedule scheduled event by id. Scheduler must be started to call this method properly.
func (*Scheduler[T]) UnscheduleByHeader ¶ added in v0.1.0
Unschedule all scheduled events with given header key-value pair. Scheduler must be started to call this method properly.
func (*Scheduler[T]) UnscheduleByTag ¶ added in v0.1.0
Unschedule all scheduled events with given tag. Scheduler must be started to call this method properly.
Click to show internal directories.
Click to hide internal directories.