mongodb

package
v0.0.0-...-1759ba1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCouldNotClearDB = errors.New("could not clear database")

ErrCouldNotClearDB is when the database could not be cleared.

View Source
var ErrCouldNotDialDB = errors.New("could not dial database")

ErrCouldNotDialDB is when the database could not be dialed.

View Source
var ErrCouldNotLoadAggregate = errors.New("could not load aggregate")

ErrCouldNotLoadAggregate is when an aggregate could not be loaded.

View Source
var ErrCouldNotMarshalEvent = errors.New("could not marshal event")

ErrCouldNotMarshalEvent is when an event could not be marshaled into BSON.

View Source
var ErrCouldNotSaveAggregate = errors.New("could not save aggregate")

ErrCouldNotSaveAggregate is when an aggregate could not be saved.

View Source
var ErrCouldNotUnmarshalEvent = errors.New("could not unmarshal event")

ErrCouldNotUnmarshalEvent is when an event could not be unmarshaled into a concrete type.

View Source
var ErrEventNotRegistered = errors.New("event not registered")

ErrEventNotRegistered is when an event is not registered.

View Source
var ErrInvalidEvent = errors.New("invalid event")

ErrInvalidEvent is when an event does not implement the Event interface.

View Source
var ErrNoDBSession = errors.New("no database session")

ErrNoDBSession is when no database session is set.

Functions

This section is empty.

Types

type EventStore

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

EventStore implements an EventStore for MongoDB.

func NewEventStore

func NewEventStore(eventBus eventhorizon.EventBus, config *EventStoreConfig) (*EventStore, error)

NewEventStore creates a new EventStore.

func (*EventStore) CreateTable

func (s *EventStore) CreateTable() error

CreateTable creates the table if it is not allready existing and correct.

func (*EventStore) DeleteTable

func (s *EventStore) DeleteTable() error

DeleteTable deletes the event table.

func (*EventStore) Load

Load loads all events for the aggregate id from the database. Returns ErrNoEventsFound if no events can be found.

func (*EventStore) RegisterEventType

func (s *EventStore) RegisterEventType(event eventhorizon.Event, factory func() eventhorizon.Event) error

RegisterEventType registers an event factory for a event type. The factory is used to create concrete event types when loading from the database.

An example would be:

eventStore.RegisterEventType(&MyEvent{}, func() Event { return &MyEvent{} })

func (*EventStore) Save

func (s *EventStore) Save(events []eventhorizon.Event) error

Save appends all events in the event stream to the database.

type EventStoreConfig

type EventStoreConfig struct {
	Table  string
	Region string
}

EventStoreConfig is a config for the DynamoDB event store.

Jump to

Keyboard shortcuts

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