go-commandbus: github.com/vsmoraes/go-commandbus Index | Files

package commandbus

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

Index

Package Files

commandbus.go

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.
    Use(...MiddlewareFunc)

    // 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

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). Updated 2019-11-11. Refresh now. Tools for package owners.