Documentation
¶
Overview ¶
Package command contains types and interfaces for implementing Command Handlers, necessary for producing side effects in your Aggregates and system, and implement your Domain's business logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
Command is a specific kind of Message that represents an intent. Commands should be phrased in the present, imperative tense, such as "ActivateUser" or "CreateOrder".
type Envelope ¶
Envelope carries both a Command and some optional Metadata attached to it.
func FromGenericEnvelope ¶
func FromGenericEnvelope[T Command](cmd GenericEnvelope) (Envelope[T], bool)
FromGenericEnvelope attempts to type-cast a GenericEnvelope instance into a strongly-typed Command Envelope.
A boolean guard is returned to signal whether the type-casting was successful or not.
func ToEnvelope ¶
ToEnvelope is a convenience function that wraps the provided Command type into an Envelope, with no metadata attached to it.
func (Envelope[T]) ToGenericEnvelope ¶
func (cmd Envelope[T]) ToGenericEnvelope() GenericEnvelope
ToGenericEnvelope returns a GenericEnvelope version of the current Envelope instance.
type GenericEnvelope ¶
GenericEnvelope is a Command Envelope that depends solely on the Command interface, not a specific generic Command type.
type Handler ¶
Handler is the interface that defines a Command Handler, a component that receives a specific kind of Command and executes the business logic related to that particular Command.
type HandlerFunc ¶
HandlerFunc is a functional type that implements the Handler interface. Useful for testing and stateless Handlers.