Documentation
¶
Index ¶
- Variables
- type Aggregate
- func (a *Aggregate) AggregateID() domain.Identifier
- func (a *Aggregate) AggregateType() string
- func (a *Aggregate) DepositMoney(c command.DepositMoney) ([]domain.Event, error)
- func (a *Aggregate) OnAccountOpened(e event.AccountOpened)
- func (a *Aggregate) OnMoneyDeposited(e event.MoneyDeposited)
- func (a *Aggregate) OnMoneyWithdrawn(e event.MoneyWithdrawn)
- func (a *Aggregate) OpenAccount(c command.OpenAccount) ([]domain.Event, error)
- func (a *Aggregate) WithdrawMoney(c command.WithdrawMoney) ([]domain.Event, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrBalanceIsNotHighEnough = errors.New("balance is not high enough")
ErrBalanceIsNotHighEnough happens when balance is not high enough.
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶
type Aggregate struct {
// contains filtered or unexported fields
}
Aggregate handles operations with an account.
func NewAggregate ¶
func NewAggregate(ID domain.Identifier) *Aggregate
NewAggregate creates a new instance of *Aggregate.
func (*Aggregate) AggregateID ¶
func (a *Aggregate) AggregateID() domain.Identifier
AggregateID returns aggregate ID.
func (*Aggregate) AggregateType ¶
AggregateType return aggregate type.
func (*Aggregate) DepositMoney ¶
DepositMoney credits the account.
func (*Aggregate) OnAccountOpened ¶
func (a *Aggregate) OnAccountOpened(e event.AccountOpened)
OnAccountOpened handles AccountOpened event.
func (*Aggregate) OnMoneyDeposited ¶
func (a *Aggregate) OnMoneyDeposited(e event.MoneyDeposited)
OnMoneyDeposited handles MoneyDeposited event.
func (*Aggregate) OnMoneyWithdrawn ¶
func (a *Aggregate) OnMoneyWithdrawn(e event.MoneyWithdrawn)
OnMoneyWithdrawn handles MoneyWithdrawn event.
func (*Aggregate) OpenAccount ¶
OpenAccount opens a new account with a given number.
func (*Aggregate) WithdrawMoney ¶
WithdrawMoney debits the account.
Click to show internal directories.
Click to hide internal directories.