Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AggRoot ¶
type AggRoot interface {
Identifiable
Pull() []Event
}
AggRoot is just an abbreviation for AggregateRoot. In DDD terms it clusters domain entities so that they act like one single unit. It has ability to capturing events. The brain of the business and handling core considerations goes here in AggRoot.
type Cmd ¶
type Cmd struct {
Name string
Payload interface{}
}
Cmd is just Command's abbreviation, in the clean architecture there's a layer which is responsible for handling system use cases. It is common to call this layer `application` layer. It acts like an orchestrator which connects different layers. A common pattern for implementing the application layer is, Command Query Responsibility Segregation or CQRS. The Cmd struct, tries to act like a command.
type CmdBag ¶
type CmdBag struct {
// contains filtered or unexported fields
}
CmdBag just holds a mapping between Cmd and CmdHandlerFactory
func (*CmdBag) Add ¶
func (cb *CmdBag) Add(cmd string, f CmdHandlerFactory)
func (*CmdBag) FactoryFor ¶
func (cb *CmdBag) FactoryFor(cmd string) (CmdHandlerFactory, error)
type CmdHandler ¶
CmdHandler is considered for being responsible to handling, one single Cmd [command]. It's common to use the domain repositories in order to ship aggregates, and using the domain functionalities to handling use cases.
type CmdHandlerFactory ¶
type CmdHandlerFactory func() CmdHandler
CmdHandlerFactory is a function that creates CmdHandler.
type Event ¶
Event is like an important happening in the domain. It can be implied a change state, or something like that.
type EventBag ¶
type EventBag struct {
// contains filtered or unexported fields
}
EventBag just holds a mapping between Event and EventHandler
func (*EventBag) Add ¶
func (e *EventBag) Add(event string, handlers ...EventHandlerFactory)
func (*EventBag) FactoryFor ¶
func (e *EventBag) FactoryFor(event string) []EventHandlerFactory
type EventHandler ¶
type EventHandler interface {
Handle(Event)
}
type EventHandlerFactory ¶
type EventHandlerFactory func() EventHandler
type Identifiable ¶
type InMemoryBus ¶
type InMemoryBus struct {
// contains filtered or unexported fields
}
func NewInMemoryBus ¶
func NewInMemoryBus(cmd *CmdBag, events *EventBag) InMemoryBus
NewInMemoryBus creates a fresh bus without any captured events.