example

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatabaseURL = "postgres://user:password@localhost/event-store?sslmode=disable"

	FooStream    = "foo-stream"
	FooEventName = "FooEvent"
	BarEventName = "BarEvent"
)
View Source
const FooReadmodelTable = "app_foo"

Variables

View Source
var ErrFooNotFound = errors.New("Foo not found")

Functions

func CreateAggregate

func CreateAggregate(ctx context.Context, pool *pgxpool.Pool)

func CreateProjection

func CreateProjection(ctx context.Context, pool *pgxpool.Pool)

func CreateQuery

func CreateQuery(ctx context.Context, pool *pgxpool.Pool)

func CreateReadModelProjection

func CreateReadModelProjection(ctx context.Context, pool *pgxpool.Pool)

Types

type BarEvent

type BarEvent struct {
	Bar string
}

type FooAggregate

type FooAggregate struct {
	eventstore.BaseAggregate

	Foo string
}

func NewFooAggregate

func NewFooAggregate() *FooAggregate

func NewFooAggregateFromHistory

func NewFooAggregateFromHistory(events eventstore.DomainEventIterator) *FooAggregate

func (*FooAggregate) WhenFooEvent

func (f *FooAggregate) WhenFooEvent(e FooEvent)

type FooEvent

type FooEvent struct {
	Foo string
}

type FooReadModel

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

func NewFooReadModel

func NewFooReadModel(client *pg.Client) *FooReadModel

func (*FooReadModel) Delete

func (f *FooReadModel) Delete(ctx context.Context) error

func (*FooReadModel) Init

func (f *FooReadModel) Init(ctx context.Context) error

func (*FooReadModel) IsInitialized

func (f *FooReadModel) IsInitialized(ctx context.Context) (bool, error)

func (*FooReadModel) Persist

func (f *FooReadModel) Persist(ctx context.Context) error

func (*FooReadModel) Reset

func (f *FooReadModel) Reset(ctx context.Context) error

func (*FooReadModel) Stack

func (f *FooReadModel) Stack(method string, args ...map[string]interface{})

type FooRepository

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

func NewFooRepository

func NewFooRepository(streamName string, eventStore *eventstore.EventStore) *FooRepository

func (FooRepository) Get

func (r FooRepository) Get(ctx context.Context, fooID uuid.UUID) (*FooAggregate, error)

func (FooRepository) Save

func (r FooRepository) Save(ctx context.Context, foo *FooAggregate) error

Jump to

Keyboard shortcuts

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