version

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

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

Repo is a middleware that adds caching to a read repository. It will update the cache when it receives events affecting the cached items. The primary purpose is to use it with smaller collections accessed often. Note that there is no limit to the cache size.

func NewRepo

func NewRepo(repo eh.ReadWriteRepo) *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 string) (eh.Entity, error)

Find implements the Find method of the eventhorizon.ReadModel 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) Notify

func (r *Repo) Notify(ctx context.Context, event eh.Event)

Notify implements the Notify method of the eventhorizon.Observer 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 string) 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.

Jump to

Keyboard shortcuts

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