pg

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	EventStreamsTable = "event_streams"
	ProjectionsTable  = "projections"
)

Variables

This section is empty.

Functions

func GenerateTableName

func GenerateTableName(streamName string) string

Types

type Client

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

func NewClient

func NewClient(db *pgxpool.Pool) *Client

func (*Client) Conn

func (c *Client) Conn() interface{}

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, collection string) error

func (*Client) Exists

func (c *Client) Exists(ctx context.Context, collection string) (bool, error)

func (*Client) Insert

func (c *Client) Insert(ctx context.Context, collection string, values map[string]interface{}) error

func (*Client) Remove

func (c *Client) Remove(ctx context.Context, collection string, identifiers map[string]interface{}) error

func (*Client) Reset

func (c *Client) Reset(ctx context.Context, collection string) error

func (*Client) Update

func (c *Client) Update(ctx context.Context, collection string, values map[string]interface{}, identifiers map[string]interface{}) error

type DomainEventIterator added in v0.2.0

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

func NewDomainEventIterator added in v0.2.0

func NewDomainEventIterator(ctx context.Context, db *pgxpool.Pool, query string, parameters []interface{}, count int) *DomainEventIterator

func (*DomainEventIterator) Close added in v0.2.0

func (it *DomainEventIterator) Close()

func (*DomainEventIterator) Current added in v0.2.0

func (it *DomainEventIterator) Current() (*eventstore.DomainEvent, error)

func (*DomainEventIterator) Error added in v0.2.0

func (it *DomainEventIterator) Error() error

func (*DomainEventIterator) IsEmpty added in v0.3.0

func (it *DomainEventIterator) IsEmpty() (bool, error)

func (*DomainEventIterator) Next added in v0.2.0

func (it *DomainEventIterator) Next() bool

func (*DomainEventIterator) Rewind added in v0.2.0

func (it *DomainEventIterator) Rewind()

func (*DomainEventIterator) ToList added in v0.2.0

func (it *DomainEventIterator) ToList() ([]eventstore.DomainEvent, error)

type PersistenceStrategy

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

func NewPersistenceStrategy

func NewPersistenceStrategy(db *pgxpool.Pool) *PersistenceStrategy

func (PersistenceStrategy) AddStreamToStreamsTable

func (ps PersistenceStrategy) AddStreamToStreamsTable(ctx context.Context, streamName string) error

func (PersistenceStrategy) AppendTo

func (ps PersistenceStrategy) AppendTo(ctx context.Context, streamName string, events []eventstore.DomainEvent) error

func (PersistenceStrategy) CreateEventStreamsTable

func (ps PersistenceStrategy) CreateEventStreamsTable(ctx context.Context) error

func (PersistenceStrategy) CreateProjectionsTable

func (ps PersistenceStrategy) CreateProjectionsTable(ctx context.Context) error

func (PersistenceStrategy) CreateSchema

func (ps PersistenceStrategy) CreateSchema(ctx context.Context, streamName string) error

func (PersistenceStrategy) DeleteStream

func (ps PersistenceStrategy) DeleteStream(ctx context.Context, streamName string) error

func (PersistenceStrategy) DropSchema

func (ps PersistenceStrategy) DropSchema(ctx context.Context, streamName string) error

func (PersistenceStrategy) FetchAllStreamNames

func (ps PersistenceStrategy) FetchAllStreamNames(ctx context.Context) ([]string, error)

func (PersistenceStrategy) HasStream

func (ps PersistenceStrategy) HasStream(ctx context.Context, streamName string) (bool, error)

func (PersistenceStrategy) Load

func (ps PersistenceStrategy) Load(ctx context.Context, streamName string, fromNumber, count int, matcher eventstore.MetadataMatcher) (eventstore.DomainEventIterator, error)

func (PersistenceStrategy) MergeAndLoad

func (PersistenceStrategy) RemoveStreamFromStreamsTable

func (ps PersistenceStrategy) RemoveStreamFromStreamsTable(ctx context.Context, streamName string) error

type ProjectionManager

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

func NewProjectionManager

func NewProjectionManager(db *pgxpool.Pool) *ProjectionManager

func (ProjectionManager) CreateProjection

func (pm ProjectionManager) CreateProjection(ctx context.Context, projectionName string, state interface{}, status eventstore.Status) error

func (ProjectionManager) DeleteProjection

func (pm ProjectionManager) DeleteProjection(ctx context.Context, projectionName string) error

func (ProjectionManager) FetchProjectionStatus

func (pm ProjectionManager) FetchProjectionStatus(ctx context.Context, projectionName string) (eventstore.Status, error)

func (ProjectionManager) LoadProjection

func (pm ProjectionManager) LoadProjection(ctx context.Context, projectionName string) (map[string]int, interface{}, error)

func (ProjectionManager) PersistProjection

func (pm ProjectionManager) PersistProjection(ctx context.Context, projectionName string, state interface{}, streamPositions map[string]int) error

func (ProjectionManager) ProjectionExists

func (pm ProjectionManager) ProjectionExists(ctx context.Context, projectionName string) (bool, error)

func (ProjectionManager) ResetProjection

func (pm ProjectionManager) ResetProjection(ctx context.Context, projectionName string, state interface{}) error

func (ProjectionManager) UpdateProjectionStatus

func (pm ProjectionManager) UpdateProjectionStatus(ctx context.Context, projectionName string, status eventstore.Status) error

Jump to

Keyboard shortcuts

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