Documentation
¶
Index ¶
- Variables
- func QuoteIdentifier(name string) string
- func QuoteString(str string) string
- type AggregateProjector
- type ConjoinedEventStore
- type ConjoinedMessageHandler
- type EventStore
- func (e *EventStore) AppendTo(ctx context.Context, streamName goengine.StreamName, ...) error
- func (e *EventStore) AppendToWithExecer(ctx context.Context, conn driverSQL.Execer, streamName goengine.StreamName, ...) error
- func (e *EventStore) Create(ctx context.Context, streamName goengine.StreamName) error
- func (e *EventStore) HasStream(ctx context.Context, streamName goengine.StreamName) bool
- func (e *EventStore) Load(ctx context.Context, streamName goengine.StreamName, fromNumber int64, ...) (goengine.EventStream, error)
- func (e *EventStore) LoadWithConnection(ctx context.Context, conn driverSQL.Queryer, streamName goengine.StreamName, ...) (goengine.EventStream, error)
- type StreamProjector
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoCreateTableQueries occurs when table create queries are not presented in the strategy ErrNoCreateTableQueries = errors.New("goengine: create table queries are not provided") // ErrTableAlreadyExists occurs when table cannot be created as it exists already ErrTableAlreadyExists = errors.New("goengine: table already exists") // ErrTableNameEmpty occurs when table cannot be created because it has an empty name ErrTableNameEmpty = errors.New("goengine: table name could not be empty") )
Functions ¶
func QuoteIdentifier ¶
QuoteIdentifier quotes an "identifier" (e.g. a table or a column name) to be used as part of an SQL statement.
Types ¶
type AggregateProjector ¶ added in v0.9.0
AggregateProjector is a postgres projector used to execute a projection per aggregate instance against an event stream
func NewAggregateProjector ¶ added in v0.9.0
func NewAggregateProjector( db *sql.DB, eventStore driverSQL.ReadOnlyEventStore, eventStoreTable string, resolver goengine.MessagePayloadResolver, aggregateTypeName string, projection goengine.Projection, projectionTable string, projectionErrorHandler driverSQL.ProjectionErrorCallback, logger goengine.Logger, ) (*AggregateProjector, error)
NewAggregateProjector creates a new projector for a projection
func (*AggregateProjector) Run ¶ added in v0.9.0
func (a *AggregateProjector) Run(ctx context.Context) error
Run executes the projection and manages the state of the projection
func (*AggregateProjector) RunAndListen ¶ added in v0.9.0
RunAndListen executes the projection and listens to any changes to the event store
type ConjoinedEventStore ¶
type ConjoinedEventStore struct { *EventStore // contains filtered or unexported fields }
ConjoinedEventStore a in postgres event store implementation which includes projection logic.
func NewConjoinedEventStore ¶
func NewConjoinedEventStore( eventstore *EventStore, resolver goengine.MessagePayloadResolver, handlers map[string]ConjoinedMessageHandler, ) (*ConjoinedEventStore, error)
NewConjoinedEventStore return a new postgres.ConjoinedEventStore
func (*ConjoinedEventStore) AppendTo ¶
func (e *ConjoinedEventStore) AppendTo(ctx context.Context, streamName goengine.StreamName, streamEvents []goengine.Message) error
AppendTo batch inserts Messages into the event stream table
type ConjoinedMessageHandler ¶
ConjoinedMessageHandler is a message handler called by the ConjoinedEventStore when a message is appended
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
EventStore a in postgres event store implementation
func NewEventStore ¶
func NewEventStore( persistenceStrategy driverSQL.PersistenceStrategy, db *sql.DB, messageFactory driverSQL.MessageFactory, logger goengine.Logger, ) (*EventStore, error)
NewEventStore return a new postgres.EventStore
func (*EventStore) AppendTo ¶
func (e *EventStore) AppendTo(ctx context.Context, streamName goengine.StreamName, streamEvents []goengine.Message) error
AppendTo batch inserts Messages into the event stream table
func (*EventStore) AppendToWithExecer ¶
func (e *EventStore) AppendToWithExecer(ctx context.Context, conn driverSQL.Execer, streamName goengine.StreamName, streamEvents []goengine.Message) error
AppendToWithExecer batch inserts Messages into the event stream table using the provided Connection/Execer
func (*EventStore) Create ¶
func (e *EventStore) Create(ctx context.Context, streamName goengine.StreamName) error
Create creates the database table, index etc needed for the event stream
func (*EventStore) HasStream ¶
func (e *EventStore) HasStream(ctx context.Context, streamName goengine.StreamName) bool
HasStream returns true if the table for the eventstream already exists
func (*EventStore) Load ¶
func (e *EventStore) Load( ctx context.Context, streamName goengine.StreamName, fromNumber int64, count *uint, matcher metadata.Matcher, ) (goengine.EventStream, error)
Load returns an eventstream based on the provided constraints
func (*EventStore) LoadWithConnection ¶
func (e *EventStore) LoadWithConnection( ctx context.Context, conn driverSQL.Queryer, streamName goengine.StreamName, fromNumber int64, count *uint, matcher metadata.Matcher, ) (goengine.EventStream, error)
LoadWithConnection returns an eventstream based on the provided constraints using the provided sql.Conn
type StreamProjector ¶ added in v0.9.0
StreamProjector is a postgres projector used to execute a projection against an event stream.
func NewStreamProjector ¶ added in v0.9.0
func NewStreamProjector( db *sql.DB, eventStore driverSQL.ReadOnlyEventStore, resolver goengine.MessagePayloadResolver, projection goengine.Projection, projectionTable string, projectionErrorHandler driverSQL.ProjectionErrorCallback, logger goengine.Logger, ) (*StreamProjector, error)
NewStreamProjector creates a new projector for a projection
func (*StreamProjector) Run ¶ added in v0.9.0
func (s *StreamProjector) Run(ctx context.Context) error
Run executes the projection and manages the state of the projection
func (*StreamProjector) RunAndListen ¶ added in v0.9.0
RunAndListen executes the projection and listens to any changes to the event store