cqrs

package
v0.0.0-...-c86e3d9 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Payload() interface{}
	Type() string
}

Command Create custom Command

type CommandBus

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

CommandBus Contains handlers

func NewCommandBus

func NewCommandBus() *CommandBus

NewCommandBus Initialize empty handlers in bus

func (*CommandBus) AddHandler

func (bus *CommandBus) AddHandler(handler CommandHandler, command interface{}) error

AddHandler to bus

func (*CommandBus) Dispatch

func (bus *CommandBus) Dispatch(command Command) error

Dispatch Calls good command process

func (*CommandBus) GetCommandsName

func (bus *CommandBus) GetCommandsName() []string

GetCommandsName of registred command

func (*CommandBus) GetLength

func (bus *CommandBus) GetLength() int

GetLength of registred command

type CommandHandler

type CommandHandler interface {
	Handle(Command) error
}

CommandHandler Allows to manage Command

type CommandImpl

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

CommandImpl Overrides Command

func NewCommandImpl

func NewCommandImpl(command interface{}) *CommandImpl

NewCommandImpl Initialize an Command implementation

func (*CommandImpl) Payload

func (c *CommandImpl) Payload() interface{}

Payload returns the actual command payload of the message.

func (*CommandImpl) Type

func (c *CommandImpl) Type() string

Type Returns command type

type Query

type Query interface {
	Payload() interface{}
	Type() string
}

Query Create custom Query

type QueryBus

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

QueryBus Contains handlers

func NewQueryBus

func NewQueryBus() *QueryBus

NewQueryBus Initialize empty handlers in bus

func (*QueryBus) AddHandler

func (bus *QueryBus) AddHandler(handler QueryHandler, Query interface{}) error

AddHandler to bus

func (*QueryBus) Dispatch

func (bus *QueryBus) Dispatch(Query Query) (interface{}, error)

Dispatch Calls good Query process

func (*QueryBus) GetLength

func (bus *QueryBus) GetLength() int

GetLength of registred command

func (*QueryBus) GetQueriesName

func (bus *QueryBus) GetQueriesName() []string

GetQueriesName of registred command

type QueryHandler

type QueryHandler interface {
	Handle(Query) (interface{}, error)
}

QueryHandler Allows to manage Query

type QueryImpl

type QueryImpl struct {
	Query interface{}
}

QueryImpl Overrides Query

func NewQueryImpl

func NewQueryImpl(Query interface{}) *QueryImpl

NewQueryImpl Initialize an Query implementation

func (*QueryImpl) Payload

func (c *QueryImpl) Payload() interface{}

Payload returns the actual Query payload of the message.

func (*QueryImpl) Type

func (c *QueryImpl) Type() string

Type Returns query type

Jump to

Keyboard shortcuts

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