Documentation
¶
Overview ¶
Package domain contains the business logic for the banking application.
Index ¶
- type AccountHandler
- type CustomerHandler
- type DailyDebitLimitHandler
- func (DailyDebitLimitHandler) Configure(c dogma.AggregateConfigurer)
- func (DailyDebitLimitHandler) HandleCommand(d *dailyDebitLimit, s dogma.AggregateCommandScope[*dailyDebitLimit], ...)
- func (DailyDebitLimitHandler) New() *dailyDebitLimit
- func (DailyDebitLimitHandler) RouteCommandToInstance(m dogma.Command) string
- type DepositProcessHandler
- type OpenAccountForNewCustomerProcessHandler
- func (OpenAccountForNewCustomerProcessHandler) Configure(c dogma.ProcessConfigurer)
- func (OpenAccountForNewCustomerProcessHandler) HandleEvent(_ context.Context, _ *dogma.StatelessProcessRoot, ...) error
- func (OpenAccountForNewCustomerProcessHandler) RouteEventToInstance(_ context.Context, m dogma.Event) (string, bool, error)
- type TransactionHandler
- func (TransactionHandler) Configure(c dogma.AggregateConfigurer)
- func (TransactionHandler) HandleCommand(t *transaction, s dogma.AggregateCommandScope[*transaction], m dogma.Command)
- func (TransactionHandler) New() *transaction
- func (TransactionHandler) RouteCommandToInstance(m dogma.Command) string
- type TransferProcessHandler
- func (TransferProcessHandler) Configure(c dogma.ProcessConfigurer)
- func (TransferProcessHandler) HandleDeadline(_ context.Context, t *transferProcess, ...) error
- func (TransferProcessHandler) HandleEvent(_ context.Context, t *transferProcess, ...) error
- func (TransferProcessHandler) New() *transferProcess
- func (TransferProcessHandler) RouteEventToInstance(_ context.Context, m dogma.Event) (string, bool, error)
- type TransferReadyToProceed
- type WithdrawalProcessHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountHandler ¶
type AccountHandler struct{}
AccountHandler implements the business logic for a bank account.
It centralizes all transactions that are applied to an account in order to enforce a strict no-overdraw policy.
func (AccountHandler) Configure ¶
func (AccountHandler) Configure(c dogma.AggregateConfigurer)
Configure configures the behavior of the engine as it relates to this handler.
func (AccountHandler) HandleCommand ¶
func (AccountHandler) HandleCommand( a *account, s dogma.AggregateCommandScope[*account], m dogma.Command, )
HandleCommand handles a command message that has been routed to this handler.
func (AccountHandler) New ¶
func (AccountHandler) New() *account
New returns a new account instance.
func (AccountHandler) RouteCommandToInstance ¶
func (AccountHandler) RouteCommandToInstance(m dogma.Command) string
RouteCommandToInstance returns the ID of the aggregate instance that is targetted by m.
type CustomerHandler ¶
type CustomerHandler struct{}
CustomerHandler implements the business logic for a bank customer.
func (CustomerHandler) Configure ¶
func (CustomerHandler) Configure(c dogma.AggregateConfigurer)
Configure configures the behavior of the engine as it relates to this handler.
func (CustomerHandler) HandleCommand ¶
func (CustomerHandler) HandleCommand( c *customer, s dogma.AggregateCommandScope[*customer], m dogma.Command, )
HandleCommand handles a command message that has been routed to this handler.
func (CustomerHandler) New ¶
func (CustomerHandler) New() *customer
New returns a new customer instance.
func (CustomerHandler) RouteCommandToInstance ¶
func (CustomerHandler) RouteCommandToInstance(m dogma.Command) string
RouteCommandToInstance returns the ID of the aggregate instance that is targetted by m.
type DailyDebitLimitHandler ¶
type DailyDebitLimitHandler struct{}
DailyDebitLimitHandler implements the business logic for an account daily debit limit policy.
It centralizes all debits that are applied to an account over a calendar day in order to enforce a policy of limited daily debits.
func (DailyDebitLimitHandler) Configure ¶
func (DailyDebitLimitHandler) Configure(c dogma.AggregateConfigurer)
Configure configures the behaviour of the engine as it relates to this handler.
func (DailyDebitLimitHandler) HandleCommand ¶
func (DailyDebitLimitHandler) HandleCommand( d *dailyDebitLimit, s dogma.AggregateCommandScope[*dailyDebitLimit], m dogma.Command, )
HandleCommand handles a command message that has been routed to this handler.
func (DailyDebitLimitHandler) New ¶
func (DailyDebitLimitHandler) New() *dailyDebitLimit
New returns a new daily debit limit instance.
func (DailyDebitLimitHandler) RouteCommandToInstance ¶
func (DailyDebitLimitHandler) RouteCommandToInstance(m dogma.Command) string
RouteCommandToInstance returns the ID of the aggregate instance that is targetted by m.
type DepositProcessHandler ¶
type DepositProcessHandler struct {
dogma.StatelessProcessBehavior
dogma.NoDeadlineMessagesBehavior[*dogma.StatelessProcessRoot]
}
DepositProcessHandler manages the process of depositing funds into an account.
func (DepositProcessHandler) Configure ¶
func (DepositProcessHandler) Configure(c dogma.ProcessConfigurer)
Configure configures the behavior of the engine as it relates to this handler.
func (DepositProcessHandler) HandleEvent ¶
func (DepositProcessHandler) HandleEvent( _ context.Context, _ *dogma.StatelessProcessRoot, s dogma.ProcessEventScope[*dogma.StatelessProcessRoot], m dogma.Event, ) error
HandleEvent handles an event message that has been routed to this handler.
func (DepositProcessHandler) RouteEventToInstance ¶
func (DepositProcessHandler) RouteEventToInstance( _ context.Context, m dogma.Event, ) (string, bool, error)
RouteEventToInstance returns the ID of the process instance that is targeted by m.
type OpenAccountForNewCustomerProcessHandler ¶
type OpenAccountForNewCustomerProcessHandler struct {
dogma.StatelessProcessBehavior
dogma.NoDeadlineMessagesBehavior[*dogma.StatelessProcessRoot]
}
OpenAccountForNewCustomerProcessHandler manages the process of opening the initial account for a new customer.
func (OpenAccountForNewCustomerProcessHandler) Configure ¶
func (OpenAccountForNewCustomerProcessHandler) Configure(c dogma.ProcessConfigurer)
Configure configures the behavior of the engine as it relates to this handler.
func (OpenAccountForNewCustomerProcessHandler) HandleEvent ¶
func (OpenAccountForNewCustomerProcessHandler) HandleEvent( _ context.Context, _ *dogma.StatelessProcessRoot, s dogma.ProcessEventScope[*dogma.StatelessProcessRoot], m dogma.Event, ) error
HandleEvent handles an event message that has been routed to this handler.
func (OpenAccountForNewCustomerProcessHandler) RouteEventToInstance ¶
func (OpenAccountForNewCustomerProcessHandler) RouteEventToInstance( _ context.Context, m dogma.Event, ) (string, bool, error)
RouteEventToInstance returns the ID of the process instance that is targetted by m.
type TransactionHandler ¶
type TransactionHandler struct{}
TransactionHandler implements the business logic for a transaction of any kind against an account.
It's sole purpose is to ensure the global uniqueness of transaction IDs.
func (TransactionHandler) Configure ¶
func (TransactionHandler) Configure(c dogma.AggregateConfigurer)
Configure configures the behavior of the engine as it relates to this handler.
func (TransactionHandler) HandleCommand ¶
func (TransactionHandler) HandleCommand( t *transaction, s dogma.AggregateCommandScope[*transaction], m dogma.Command, )
HandleCommand handles a command message that has been routed to this handler.
func (TransactionHandler) New ¶
func (TransactionHandler) New() *transaction
New returns a new transaction instance.
func (TransactionHandler) RouteCommandToInstance ¶
func (TransactionHandler) RouteCommandToInstance(m dogma.Command) string
RouteCommandToInstance returns the ID of the aggregate instance that is targetted by m.
type TransferProcessHandler ¶
type TransferProcessHandler struct{}
TransferProcessHandler manages the process of transferring funds between accounts.
func (TransferProcessHandler) Configure ¶
func (TransferProcessHandler) Configure(c dogma.ProcessConfigurer)
Configure configures the behavior of the engine as it relates to this handler.
func (TransferProcessHandler) HandleDeadline ¶
func (TransferProcessHandler) HandleDeadline( _ context.Context, t *transferProcess, s dogma.ProcessDeadlineScope[*transferProcess], m dogma.Deadline, ) error
HandleDeadline handles a deadline message that has been routed to this handler.
func (TransferProcessHandler) HandleEvent ¶
func (TransferProcessHandler) HandleEvent( _ context.Context, t *transferProcess, s dogma.ProcessEventScope[*transferProcess], m dogma.Event, ) error
HandleEvent handles an event message that has been routed to this handler.
func (TransferProcessHandler) New ¶
func (TransferProcessHandler) New() *transferProcess
New returns a new transfer instance.
func (TransferProcessHandler) RouteEventToInstance ¶
func (TransferProcessHandler) RouteEventToInstance( _ context.Context, m dogma.Event, ) (string, bool, error)
RouteEventToInstance returns the ID of the process instance that is targeted by m.
type TransferReadyToProceed ¶
type TransferReadyToProceed struct {
TransactionID string
}
TransferReadyToProceed is a deadline message notifying that the transfer is ready to proceed.
func (*TransferReadyToProceed) MarshalBinary ¶
func (m *TransferReadyToProceed) MarshalBinary() ([]byte, error)
MarshalBinary returns a binary representation of the message. For simplicity in this example we use JSON.
func (*TransferReadyToProceed) MessageDescription ¶
func (m *TransferReadyToProceed) MessageDescription() string
MessageDescription returns a human-readable description of the message.
func (*TransferReadyToProceed) UnmarshalBinary ¶
func (m *TransferReadyToProceed) UnmarshalBinary(data []byte) error
UnmarshalBinary populates the message from its binary representation. For simplicity in this example we use JSON.
func (*TransferReadyToProceed) Validate ¶
func (m *TransferReadyToProceed) Validate(dogma.DeadlineValidationScope) error
Validate returns a non-nil error if the message is invalid.
type WithdrawalProcessHandler ¶
type WithdrawalProcessHandler struct {
dogma.StatelessProcessBehavior
dogma.NoDeadlineMessagesBehavior[*dogma.StatelessProcessRoot]
}
WithdrawalProcessHandler manages the process of withdrawing funds from an account.
func (WithdrawalProcessHandler) Configure ¶
func (WithdrawalProcessHandler) Configure(c dogma.ProcessConfigurer)
Configure configures the behavior of the engine as it relates to this handler.
func (WithdrawalProcessHandler) HandleEvent ¶
func (WithdrawalProcessHandler) HandleEvent( _ context.Context, _ *dogma.StatelessProcessRoot, s dogma.ProcessEventScope[*dogma.StatelessProcessRoot], m dogma.Event, ) error
HandleEvent handles an event message that has been routed to this handler.
func (WithdrawalProcessHandler) RouteEventToInstance ¶
func (WithdrawalProcessHandler) RouteEventToInstance( _ context.Context, m dogma.Event, ) (string, bool, error)
RouteEventToInstance returns the ID of the process instance that is targetted by m.