scheduler

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMiddleware

func NewMiddleware() (eh.CommandHandlerMiddleware, chan Error)

NewMiddleware returns a new async handling middleware that returns any errors on a error channel.

Types

type Command

type Command interface {
	eh.Command

	// ExecuteAt returns the time when the command will execute.
	ExecuteAt() time.Time
}

Command is a scheduled command with an execution time.

func CommandWithExecuteTime

func CommandWithExecuteTime(cmd eh.Command, t time.Time) Command

CommandWithExecuteTime returns a wrapped command with a execution time set.

type Error

type Error struct {
	// Err is the error that happened when handling the command.
	Err error
	// Ctx is the context used when the error happened.
	Ctx context.Context
	// Command is the command handeled when the error happened.
	Command eh.Command
}

Error is an async error containing the error and the command.

func (Error) Cause added in v0.9.0

func (e Error) Cause() error

Cause implements the github.com/pkg/errors Unwrap method.

func (Error) Error

func (e Error) Error() string

Error implements the Error method of the error interface.

func (Error) Unwrap added in v0.9.0

func (e Error) Unwrap() error

Unwrap implements the errors.Unwrap method.

Jump to

Keyboard shortcuts

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