go-commandbus: github.com/lana/go-commandbus Index | Files | Directories

package commandbus

import "github.com/lana/go-commandbus"


Package Files


type CommandBus Uses

type CommandBus interface {
    // Register assign a command to a command handle for future executions.
    Register(interface{}, interface{}) error

    // Handlers returns all registered handlers.
    Handlers() handlers

    // Use adds middleware to the chain.

    // Execute send a given Command to its assigned command handler.
    Execute(context.Context, interface{}) error

CommandBus is the definition of how command should be handled

func New Uses

func New() CommandBus

New creates a new command bus.

type HandlerFunc Uses

type HandlerFunc func(context.Context, interface{}) error

HandlerFunc defines a function to execute the command handler. This function type is only used by `MiddlewareFunc`.

type MiddlewareFunc Uses

type MiddlewareFunc func(h HandlerFunc) HandlerFunc

MiddlewareFunc defines a function to process middleware. it receives the next Handler must return another handler



Package commandbus imports 4 packages (graph) and is imported by 2 packages. Updated 2020-07-11. Refresh now. Tools for package owners.