memory

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrModelNotSet = errors.New("model not set")

ErrModelNotSet is when an model factory is not set on the Repo.

Functions

This section is empty.

Types

type Repo

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

Repo implements an in memory repository of read models.

func NewRepo

func NewRepo() *Repo

NewRepo creates a new Repo.

func Repository

func Repository(repo eh.ReadRepo) *Repo

Repository returns a parent ReadRepo if there is one.

func (*Repo) Find

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

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

func (*Repo) FindAll

func (r *Repo) FindAll(ctx context.Context) ([]eh.Entity, error)

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

func (*Repo) Parent

func (r *Repo) Parent() eh.ReadRepo

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

func (*Repo) Remove

func (r *Repo) Remove(ctx context.Context, id uuid.UUID) error

Remove implements the Remove method of the eventhorizon.WriteRepo interface.

func (*Repo) Save

func (r *Repo) Save(ctx context.Context, entity eh.Entity) error

Save implements the Save method of the eventhorizon.WriteRepo interface.

func (*Repo) SetEntityFactory added in v0.7.0

func (r *Repo) SetEntityFactory(f func() eh.Entity)

SetEntityFactory sets a factory function that creates concrete entity types.

Jump to

Keyboard shortcuts

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