mongodb

package
v0.0.0-...-6ed1490 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDup

func IsDup(err error) bool

IsDup check it error is duplicate

Types

type EventStore

type EventStore struct {
	LogDebugfFunc LogDebugfFunc
	// contains filtered or unexported fields
}

EventStore implements an EventStore for MongoDB.

func NewEventStore

func NewEventStore(ctx context.Context, host, dbPrefix string, colPrefix string, batchSize int, goroutinePoolGo eventstore.GoroutinePoolGoFunc, eventMarshaler event.MarshalerFunc, eventUnmarshaler event.UnmarshalerFunc, LogDebugfFunc LogDebugfFunc, opts ...*options.ClientOptions) (*EventStore, error)

NewEventStore creates a new EventStore.

func NewEventStoreWithClient

func NewEventStoreWithClient(ctx context.Context, client *mongo.Client, dbPrefix string, colPrefix string, batchSize int, goroutinePoolGo eventstore.GoroutinePoolGoFunc, eventMarshaler event.MarshalerFunc, eventUnmarshaler event.UnmarshalerFunc, LogDebugfFunc LogDebugfFunc) (*EventStore, error)

NewEventStoreWithClient creates a new EventStore with a session.

func (*EventStore) Clear

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

Clear clears the event storage.

func (*EventStore) Close

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

Close closes the database session.

func (*EventStore) DBName

func (s *EventStore) DBName() string

DBName returns db name

func (*EventStore) Insert

func (s *EventStore) Insert(ctx context.Context, task maintenance.Task) error

Insert stores (or updates) the information about the latest snapshot version per aggregate into the DB

func (*EventStore) LoadFromSnapshot

func (s *EventStore) LoadFromSnapshot(ctx context.Context, queries []eventstore.SnapshotQuery, eventHandler event.Handler) error

Load loads events from begining.

func (*EventStore) LoadFromVersion

func (s *EventStore) LoadFromVersion(ctx context.Context, queries []eventstore.VersionQuery, eh event.Handler) error

LoadFromVersion loads aggragates events from version.

func (*EventStore) LoadSnapshotQueries

func (s *EventStore) LoadSnapshotQueries(ctx context.Context, queries []eventstore.SnapshotQuery, qh *loader) error

func (*EventStore) LoadUpToVersion

func (s *EventStore) LoadUpToVersion(ctx context.Context, queries []eventstore.VersionQuery, eh event.Handler) error

LoadUpToVersion loads aggragates events up to a specific version.

func (*EventStore) Query

func (s *EventStore) Query(ctx context.Context, limit int, taskHandler maintenance.TaskHandler) error

Query retrieves the latest snapshot version per aggregate for thw number of aggregates specified by 'limit'

func (*EventStore) Remove

func (s *EventStore) Remove(ctx context.Context, task maintenance.Task) error

Remove deletes (the latest snapshot version) database record for a given aggregate ID

func (*EventStore) RemoveUpToVersion

func (s *EventStore) RemoveUpToVersion(ctx context.Context, queries []eventstore.VersionQuery) error

RemoveUpToVersion deletes the aggragates events up to a specific version.

func (*EventStore) Save

func (s *EventStore) Save(ctx context.Context, groupId, aggregateId string, events []event.Event) (concurrencyException bool, err error)

Save save events to path.

func (*EventStore) SaveSnapshot

func (s *EventStore) SaveSnapshot(ctx context.Context, groupId string, aggregateId string, ev event.Event) (concurrencyException bool, err error)

func (*EventStore) SaveSnapshotQuery

func (s *EventStore) SaveSnapshotQuery(ctx context.Context, groupID, aggregateID string, version uint64) (concurrencyException bool, err error)

SaveSnapshotQuery upserts the snapshot record

type LogDebugfFunc

type LogDebugfFunc func(fmt string, args ...interface{})

Jump to

Keyboard shortcuts

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