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

package commandbus

import "github.com/lana/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

Directories

PathSynopsis
middleware

Package commandbus imports 4 packages (graph) and is imported by 2 packages. Updated 2019-10-25. Refresh now. Tools for package owners.