postgres

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateProjectorCreateSchema

func AggregateProjectorCreateSchema(projectionTable string, streamName goengine.StreamName, streamTable string) []string

AggregateProjectorCreateSchema return the sql statement needed for the postgres database in order to use the AggregateProjector

func NewSingleStreamStrategy

func NewSingleStreamStrategy(converter goengine.MessagePayloadConverter) (sql.PersistenceStrategy, error)

NewSingleStreamStrategy is the constructor postgres for PersistenceStrategy interface

func StreamProjectorCreateSchema

func StreamProjectorCreateSchema(projectionTable string, streamName goengine.StreamName, streamTable string) []string

StreamProjectorCreateSchema return the sql statement needed for the postgres database in order to use the StreamProjector

Types

type SingleStreamManager

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

SingleStreamManager is a helper for creating JSON Postgres event stores and projectors

func NewSingleStreamManager

func NewSingleStreamManager(db *sql.DB, logger goengine.Logger, metrics driverSQL.Metrics) (*SingleStreamManager, error)

NewSingleStreamManager return a new instance of the SingleStreamManager

func (*SingleStreamManager) NewAggregateProjector

func (m *SingleStreamManager) NewAggregateProjector(
	eventStream goengine.StreamName,
	aggregateTypeName string,
	projectionTable string,
	projection goengine.Projection,
	projectionErrorHandler driverSQL.ProjectionErrorCallback,
	useLockedField bool,
	retryDelay time.Duration,
) (*driverSQL.AggregateProjector, error)

NewAggregateProjector returns a new aggregate projector instance

func (*SingleStreamManager) NewEventStore

func (m *SingleStreamManager) NewEventStore() (*postgres.EventStore, error)

NewEventStore returns a new event store instance

func (*SingleStreamManager) NewStreamProjector

func (m *SingleStreamManager) NewStreamProjector(
	projectionTable string,
	projection goengine.Projection,
	projectionErrorHandler driverSQL.ProjectionErrorCallback,
	useLockedField bool,
) (*driverSQL.StreamProjector, error)

NewStreamProjector returns a new stream projector instance

func (*SingleStreamManager) PersistenceStrategy

func (m *SingleStreamManager) PersistenceStrategy() driverSQL.PersistenceStrategy

PersistenceStrategy returns the sql persistence strategy

func (*SingleStreamManager) RegisterPayloads

func (m *SingleStreamManager) RegisterPayloads(initiators map[string]json.PayloadInitiator) error

RegisterPayloads registers a set of payload type initiators

type SingleStreamStrategy

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

SingleStreamStrategy struct represents eventstore with single stream

func (*SingleStreamStrategy) CreateSchema

func (s *SingleStreamStrategy) CreateSchema(tableName string) []string

CreateSchema returns a valid set of SQL statements to create the event store tables and indexes

func (*SingleStreamStrategy) EventColumnNames

func (s *SingleStreamStrategy) EventColumnNames() []string

EventColumnNames returns the columns that need to be select an event from the table

func (*SingleStreamStrategy) GenerateTableName

func (s *SingleStreamStrategy) GenerateTableName(streamName goengine.StreamName) (string, error)

GenerateTableName returns a valid table name for postgres

func (*SingleStreamStrategy) InsertColumnNames

func (s *SingleStreamStrategy) InsertColumnNames() []string

InsertColumnNames returns the columns that need to be inserted into the table in the correct order

func (*SingleStreamStrategy) PrepareData

func (s *SingleStreamStrategy) PrepareData(messages []goengine.Message) ([]interface{}, error)

PrepareData transforms a slice of messaging into a flat interface slice with the correct column order

func (*SingleStreamStrategy) PrepareSearch

func (s *SingleStreamStrategy) PrepareSearch(matcher metadata.Matcher) ([]byte, []interface{})

PrepareSearch returns the where part for searching the event store

Jump to

Keyboard shortcuts

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