filestore

package
v0.0.0-...-4ca8788 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFilePerm os.FileMode = 0644
View Source
const DefaultFolderPerm os.FileMode = 0777

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 Base

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

func NewBase

func NewBase(folder string) *Base

func (*Base) Close

func (s *Base) Close(_ context.Context)

type EventStore

type EventStore struct {
	*Base
}

func NewEventStore

func NewEventStore(folder string) *EventStore

func (*EventStore) Clear

func (s *EventStore) Clear(ctx context.Context) error

func (*EventStore) Close

func (s *EventStore) Close() error

func (*EventStore) Load

func (s *EventStore) Load(ctx context.Context, id uuid.UUID) (ret []eh.Event, err error)

func (*EventStore) LoadFrom

func (s *EventStore) LoadFrom(ctx context.Context, id uuid.UUID, version int) (ret []eh.Event, err error)

func (*EventStore) Save

func (s *EventStore) Save(ctx context.Context, events []eh.Event, originalVersion int) (err error)

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

type Repo

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

Repo implements an in memory repository of read models.

func NewRepo

func NewRepo(folder string) (ret *Repo, err error)

NewRepo creates a new Repo.

func (*Repo) Close

func (r *Repo) Close() (err error)

func (*Repo) Find

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

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

func (*Repo) FindAll

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

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

func (*Repo) InnerRepo

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

func (*Repo) MkdirParents

func (r *Repo) MkdirParents(file string) error

func (*Repo) Remove

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

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

func (*Repo) Save

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

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

func (*Repo) SetEntityFactory

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