postgres

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OffsetStore

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

OffsetStore implements the OffsetStore interface and helps persist events in a Postgres database

func NewOffsetStore

func NewOffsetStore(config *postgres.Config) *OffsetStore

NewOffsetStore creates an instance of OffsetStore

func (*OffsetStore) Connect

func (x *OffsetStore) Connect(ctx context.Context) error

Connect connects to the underlying postgres database

func (*OffsetStore) Disconnect

func (x *OffsetStore) Disconnect(ctx context.Context) error

Disconnect disconnects from the underlying postgres database

func (*OffsetStore) GetCurrentOffset

func (x *OffsetStore) GetCurrentOffset(ctx context.Context, projectionID *egopb.ProjectionId) (currentOffset *egopb.Offset, err error)

GetCurrentOffset returns the current offset of a given projection id

func (*OffsetStore) Ping

func (x *OffsetStore) Ping(ctx context.Context) error

Ping verifies a connection to the database is still alive, establishing a connection if necessary.

func (*OffsetStore) ResetOffset

func (x *OffsetStore) ResetOffset(ctx context.Context, projectionName string, value int64) error

ResetOffset resets the offset of given projection to a given value across all shards

func (*OffsetStore) WriteOffset

func (x *OffsetStore) WriteOffset(ctx context.Context, offset *egopb.Offset) error

WriteOffset writes an offset into the offset store

type SchemaUtils

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

SchemaUtils help create the various test tables in unit/integration tests

func NewSchemaUtils

func NewSchemaUtils(db *postgres.TestDB) *SchemaUtils

NewSchemaUtils creates an instance of SchemaUtils

func (SchemaUtils) CreateTable

func (d SchemaUtils) CreateTable(ctx context.Context) error

CreateTable creates the event store table used for unit tests

func (SchemaUtils) DropTable

func (d SchemaUtils) DropTable(ctx context.Context) error

DropTable drop the table used in unit test This is useful for resource cleanup after a unit test

Jump to

Keyboard shortcuts

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