version

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventStoreReader

type EventStoreReader interface {
	// LoadFrom loads all events from version for the aggregate id from the store.
	LoadFrom(ctx context.Context, id uuid.UUID, version int) ([]eh.Event, error)
}

type MinVersionFunc

type MinVersionFunc = func(ctx context.Context, uuid2 uuid.UUID) (int, bool)

type Repo

type Repo struct {
	eh.ReadWriteRepo
	// contains filtered or unexported fields
}

Repo is a middleware that adds version checking to a read repository.

func IntoRepo

func IntoRepo(ctx context.Context, repo eh.ReadRepo) *Repo

IntoRepo tries to convert an eh.ReadRepo into a Repo by recursively looking at inner repos. Returns nil if none was found.

func NewRepo

func NewRepo(repo eh.ReadWriteRepo, eventStore EventStoreReader) *Repo

NewRepo creates a new Repo. Uses the supplied event store to find the min version number of a given stream/aggregate

func (*Repo) Find

func (r *Repo) Find(ctx context.Context, id uuid.UUID) (eh.Entity, error)

Find implements the Find method of the eventhorizon.ReadModel interface. If the context contains a min version set by WithMinVersion it will only return an item if its version is at least min version. If a timeout or deadline is set on the context it will repeatedly try to get the item until either the version matches or the deadline is reached.

func (*Repo) InnerRepo

func (r *Repo) InnerRepo(_ context.Context) eh.ReadRepo

InnerRepo implements the InnerRepo method of the eventhorizon.ReadRepo interface.

Jump to

Keyboard shortcuts

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