Documentation
¶
Index ¶
- Constants
- func CustomSnapshot(ctx context.Context, root *Account, _, _ version.Version, ...) bool
- func NewEmptyMaker(timeProvider timeutils.TimeProvider) func() *Account
- type Account
- func (a *Account) Apply(evt AccountEvent) error
- func (a *Account) Balance() int
- func (a *Account) DepositMoney(amount int) error
- func (a *Account) EventFuncs() event.FuncsFor[AccountEvent]
- func (a *Account) HolderName() string
- func (a *Account) ID() AccountID
- func (a *Account) WithdrawMoney(amount int) (int, error)
- type AccountEvent
- type AccountID
- type AccountOutboxProcessor
- type AccountsWithNameProcessor
- type Snapshot
- type Snapshotter
Constants ¶
View Source
const EventNameAccountOpened = "account/opened"
Variables ¶
This section is empty.
Functions ¶
func CustomSnapshot ¶
func CustomSnapshot( ctx context.Context, root *Account, _, _ version.Version, _ aggregate.CommittedEvents[AccountEvent], ) bool
func NewEmptyMaker ¶
func NewEmptyMaker(timeProvider timeutils.TimeProvider) func() *Account
Types ¶
type Account ¶
func (*Account) Apply ¶
func (a *Account) Apply(evt AccountEvent) error
func (*Account) DepositMoney ¶
func (*Account) EventFuncs ¶
func (a *Account) EventFuncs() event.FuncsFor[AccountEvent]
func (*Account) HolderName ¶
type AccountEvent ¶
type AccountOutboxProcessor ¶
type AccountOutboxProcessor struct{}
func NewAccountOutboxProcessor ¶
func NewAccountOutboxProcessor(db *sql.DB) (*AccountOutboxProcessor, error)
func (*AccountOutboxProcessor) Process ¶
func (p *AccountOutboxProcessor) Process( ctx context.Context, tx *sql.Tx, root *Account, committedEvents aggregate.CommittedEvents[AccountEvent], ) error
Process writes committed AccountEvents to the outbox table within the same transaction.
type AccountsWithNameProcessor ¶
type AccountsWithNameProcessor struct{}
func NewAccountsWithNameProcessor ¶
func NewAccountsWithNameProcessor(db *sql.DB) (*AccountsWithNameProcessor, error)
func (*AccountsWithNameProcessor) Process ¶
func (p *AccountsWithNameProcessor) Process( ctx context.Context, tx *sql.Tx, root *Account, events aggregate.CommittedEvents[AccountEvent], ) error
type Snapshot ¶
type Snapshotter ¶
type Snapshotter struct {
TimeProvider timeutils.TimeProvider
}
func (*Snapshotter) FromSnapshot ¶
func (s *Snapshotter) FromSnapshot(snap *Snapshot) (*Account, error)
func (*Snapshotter) ToSnapshot ¶
func (s *Snapshotter) ToSnapshot(acc *Account) (*Snapshot, error)
Click to show internal directories.
Click to hide internal directories.