es

package
v0.0.0-...-b8c8fdf Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateType

func AggregateType(aggregate Aggregate) string

func EventName

func EventName(event Event) string

Types

type Aggregate

type Aggregate interface {
	ID() ID
}

Aggregate defines the base aggregate operations.

type Event

type Event interface {
	IsEvent()
}

Event is a domain event marker

type ID

type ID = uuid.UUID

type Record

type Record struct {
	// Version contains the version associated with the serialized event
	Version int32

	// Data contains the event in serialized form
	Data json.RawMessage
}

Record provides the serialized representation of the event

type Store

type Store interface {
	// Save the provided serialized records to the store
	Save(ctx context.Context, aggregate Aggregate, records ...Record) error

	// Load the stream of events up to the version specified.
	// When toVersion is 0, all events will be loaded.
	// To start at the beginning, fromVersion should be set to 0
	// fromVersion and toVersion values are inclusive
	Load(ctx context.Context, aggregateID ID, fromVersion, toVersion int32) (Stream, error)
}

Store provides an abstraction for the Repository to save data

type Stream

type Stream []Record

Stream represents

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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