cron

package
v0.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventHandler

type EventHandler struct {
	eh.EventHandler
	// contains filtered or unexported fields
}

EventHandler is a cron runner that inserts timed events into the event stream. It uses the cron syntax from https://github.com/gorhill/cronexpr.

func NewEventHandler

func NewEventHandler(eventHandler eh.EventHandler) *EventHandler

NewEventHandler creates a new EventHandler.

func (*EventHandler) Error

func (h *EventHandler) Error() <-chan error

Error returns the error channel.

func (*EventHandler) ScheduleEvent

func (h *EventHandler) ScheduleEvent(ctx context.Context, cronLine string, eventFunc func(time.Time) eh.Event) error

ScheduleEvent schedules an event to be sent on regular intervals, using a line in the crontab format to setup the timing. The eventFunc should create the event to send given the triggered time as input. Cancelling the context will stop the triggering of more events.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL