bus

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHandlerAlreadySet = errors.New("handler is already set")

ErrHandlerAlreadySet is when a handler is already registered for a command.

View Source
var ErrHandlerNotFound = errors.New("no handlers for command")

ErrHandlerNotFound is when no handler can be found.

Functions

This section is empty.

Types

type CommandHandler

type CommandHandler struct {
	// contains filtered or unexported fields
}

CommandHandler is a command handler that handles commands by routing to the registered CommandHandlers.

func NewCommandHandler

func NewCommandHandler() *CommandHandler

NewCommandHandler creates a CommandHandler.

func (*CommandHandler) HandleCommand

func (h *CommandHandler) HandleCommand(ctx context.Context, cmd eh.Command) error

HandleCommand handles a command with a handler capable of handling it.

func (*CommandHandler) SetHandler

func (h *CommandHandler) SetHandler(handler eh.CommandHandler, cmdType eh.CommandType) error

SetHandler adds a handler for a specific command.

Jump to

Keyboard shortcuts

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