postgres

package
v1.0.1-0...-336119c Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JournalStore

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

JournalStore implements the JournalStore interface and helps persist events in a Postgres database This should be instantiated once and reused in the application

func NewJournalStore

func NewJournalStore(config *postgres.Config) *JournalStore

NewJournalStore creates a new instance of PostgresEventStore

func (*JournalStore) Connect

func (s *JournalStore) Connect(ctx context.Context) error

Connect connects to the underlying postgres database

func (*JournalStore) DeleteJournals

func (s *JournalStore) DeleteJournals(ctx context.Context, persistenceID string, toSequenceNumber uint64) error

DeleteJournals deletes journals from the postgres up to a given sequence number (inclusive)

func (*JournalStore) Disconnect

func (s *JournalStore) Disconnect(ctx context.Context) error

Disconnect disconnects from the underlying postgres database

func (*JournalStore) GetLatestJournal

func (s *JournalStore) GetLatestJournal(ctx context.Context, persistenceID string) (*local.Journal, error)

GetLatestJournal fetches the latest journal

func (*JournalStore) PersistJournals

func (s *JournalStore) PersistJournals(ctx context.Context, journals []*local.Journal) error

PersistJournals writes a bunch of journals into the underlying postgres database

func (*JournalStore) PersistenceIDs

func (s *JournalStore) PersistenceIDs(ctx context.Context) (persistenceIDs []string, err error)

PersistenceIDs returns the distinct list of all the persistence ids in the journal store

func (*JournalStore) Ping

func (s *JournalStore) Ping(ctx context.Context) error

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

func (*JournalStore) ReplayJournals

func (s *JournalStore) ReplayJournals(ctx context.Context, persistenceID string, fromSequenceNumber, toSequenceNumber uint64, max uint64) ([]*local.Journal, error)

ReplayJournals fetches events for a given persistence ID from a given sequence number(inclusive) to a given sequence number(inclusive)

type LegacyJournalStore

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

LegacyJournalStore implements the JournalStore

func NewLegacyJournalStore

func NewLegacyJournalStore(config *postgres.Config) *LegacyJournalStore

NewLegacyJournalStore creates a new instance of LegacyJournalStore

func (*LegacyJournalStore) Connect

func (s *LegacyJournalStore) Connect(ctx context.Context) error

Connect connects to the underlying postgres database

func (*LegacyJournalStore) Disconnect

func (s *LegacyJournalStore) Disconnect(ctx context.Context) error

Disconnect disconnects from the underlying postgres database

func (*LegacyJournalStore) GetLatestJournal

func (s *LegacyJournalStore) GetLatestJournal(ctx context.Context, persistenceID string) (*local.LegacyJournal, error)

GetLatestJournal fetches the latest journal TODO: enhance it with one query instead of the two queries

func (*LegacyJournalStore) PersistJournal

func (s *LegacyJournalStore) PersistJournal(ctx context.Context, journal *local.LegacyJournal) error

PersistJournal persist a journal

func (*LegacyJournalStore) Ping

func (s *LegacyJournalStore) Ping(ctx context.Context) error

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

Jump to

Keyboard shortcuts

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