test

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FooAggregate is the aggregate name for Foo.
	FooAggregate = "foo"
)

Variables

This section is empty.

Functions

func NewAggregate

func NewAggregate(name string, id uuid.UUID, opts ...AggregateOption) aggregate.Aggregate

NewAggregate returns a new test aggregate.

Types

type AggregateOption

type AggregateOption func(*testAggregate)

AggregateOption is an option for a test aggregate.

func ApplyEventFunc

func ApplyEventFunc(eventName string, fn func(event.Event)) AggregateOption

ApplyEventFunc returns an aggregateOption that allows users to intercept calls to a.ApplyEvent.

func CommitFunc

func CommitFunc(fn func(flush func())) AggregateOption

CommitFunc returns an aggregateOption that allows users to intercept a.Commit calls. fn accepts a flush() function that can be called to actually flush the changes.

func RecordChangeFunc added in v0.1.2

func RecordChangeFunc(fn func(changes []event.Event, track func(...event.Event))) AggregateOption

RecordChangeFunc returns an aggregateOption that allows users to intercept calls to a.RecordChange.

type Foo

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

Foo is an example aggregate used for testing.

func NewFoo

func NewFoo(id uuid.UUID, opts ...AggregateOption) *Foo

NewFoo returns a new Foo.

func (*Foo) ApplyEvent

func (a *Foo) ApplyEvent(evt event.Event)

func (*Foo) Commit

func (a *Foo) Commit()

func (*Foo) RecordChange added in v0.1.2

func (a *Foo) RecordChange(changes ...event.Event)

Jump to

Keyboard shortcuts

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