core

package module
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2025 License: MPL-2.0 Imports: 3 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrConcurrency = errors.New("concurrency error")

ErrConcurrency when the currently saved version of the aggregate differs from the new ones

View Source
var ErrSnapshotNotFound = errors.New("snapshot not found")

ErrSnapshotNotFound returned when no snapshot is found in the snapshot store

Functions

This section is empty.

Types

type Event

type Event struct {
	AggregateID   string
	Version       Version
	GlobalVersion Version
	AggregateType string
	Timestamp     time.Time
	Reason        string // based on the Data type
	Data          []byte // interface{} on the external Event type
	Metadata      []byte // map[string]interface{} on the external Event type
}

Event holding meta data and the application specific event in the Data property

type EventStore

type EventStore interface {
	Save(events []Event) error
	Get(ctx context.Context, id string, aggregateType string, afterVersion Version) (Iterator, error)
}

EventStore interface expose the methods an event store must uphold

type Fetcher added in v0.5.0

type Fetcher func() (Iterator, error)

Fetcher is the event fetch function concumed by projections

type Iterator

type Iterator interface {
	Next() bool
	Value() (Event, error)
	Close()
}

Iterator is the interface an event store Get needs to return

type Snapshot added in v0.4.0

type Snapshot struct {
	ID            string
	Type          string
	Version       Version
	GlobalVersion Version
	State         []byte
}

Snapshot holds current state of an aggregate

type SnapshotStore added in v0.4.0

type SnapshotStore interface {
	Save(snapshot Snapshot) error
	Get(ctx context.Context, id, aggregateType string) (Snapshot, error)
}

SnapshotStore expose the methods a snapshot store must uphold

type Version

type Version uint64

Version is the event version used in event.Version and event.GlobalVersio

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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