repositories

package
v0.0.0-...-1aa1bea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	EventDelegate      *ycq.DelegateEventFactory
	StreamNameDelegate *ycq.DelegateStreamNamer
	AggregateDelegate  *ycq.DelegateAggregateFactory
	// contains filtered or unexported fields
}

Account is the repository of bank accounts

func NewAccount

func NewAccount(eventStore *goes.Client, eventBus ycq.EventBus) (*Account, error)

NewAccount returns a new account repository instance

func (Account) Load

func (r Account) Load(aggregateType, id string) (*aggregates.Account, error)

Load loads a aggregate with the given id

func (Account) Save

func (r Account) Save(aggregate ycq.AggregateRoot, expectedVersion *int) error

Save saves a given aggregate to the event store

type AccountRepository

type AccountRepository interface {
	Load(string, string) (*aggregates.Account, error)
	Save(ycq.AggregateRoot, *int) error
}

AccountRepository is the interface for a repository for bank accounts

type InMemoryAccount

type InMemoryAccount struct {
	// contains filtered or unexported fields
}

InMemoryAccount is a in memory repository for bank accounts used for testing

func NewInMemoryAccount

func NewInMemoryAccount(eventbus ycq.EventBus) *InMemoryAccount

func (*InMemoryAccount) Load

func (r *InMemoryAccount) Load(aggregateType, id string) (*aggregates.Account, error)

Load loads an aggregate of the specified type.

func (*InMemoryAccount) Save

func (r *InMemoryAccount) Save(aggregate ycq.AggregateRoot, _ *int) error

Save persists an aggregate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL