database

package
v0.0.0-...-14b8f79 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, dsn string) (*pgxpool.Pool, error)

func DSNTest

func DSNTest(t *testing.T) string

func Migrate

func Migrate(ctx context.Context, db dbtx.DBTX, schema *Schema) error

func ToDSN

func ToDSN(conn *pgxpool.Conn) string

Types

type Listener

type Listener struct {
}

type OutboxWatermark

type OutboxWatermark struct {
	Watermark  int64
	RetryCount int64
	StreamID   string
}

type Schema

type Schema struct {
	Prefix string
}

func NewSchema

func NewSchema(prefix string) (*Schema, error)

func (*Schema) AdvisoryLock

func (s *Schema) AdvisoryLock(ctx context.Context, db dbtx.DBTX, pid int) error

func (*Schema) AdvisoryUnlock

func (s *Schema) AdvisoryUnlock(ctx context.Context, db dbtx.DBTX, pid int) error

func (*Schema) ApproveLease

func (s *Schema) ApproveLease(ctx context.Context, db dbtx.DBTX, vnodes []uint32) error

func (*Schema) CreateMigrationTable

func (s *Schema) CreateMigrationTable(ctx context.Context, db dbtx.DBTX) error

func (*Schema) InsertLease

func (s *Schema) InsertLease(ctx context.Context, db dbtx.DBTX, vnode uint32, name string, ttl time.Duration, status string) error

func (*Schema) InsertMigrationRow

func (s *Schema) InsertMigrationRow(ctx context.Context, db dbtx.DBTX, version uint32, name string, hash string) error

func (*Schema) InsertOutbox

func (s *Schema) InsertOutbox(ctx context.Context, tx dbtx.DBTX, streamType, streamID, storeStreamID string, eventNumber, watermark int64, partition uint32) (int64, error)

func (*Schema) Listen

func (s *Schema) Listen(ctx context.Context, db dbtx.DBTX, partitions []uint32) error

func (*Schema) Notify

func (s *Schema) Notify(ctx context.Context, db dbtx.DBTX, partition uint32, payload string) error

func (*Schema) RefreshLeases

func (s *Schema) RefreshLeases(ctx context.Context, db dbtx.DBTX, nodeName string, ttl time.Duration) (leases.Ring, error)

func (*Schema) SelectCurrentMigration

func (s *Schema) SelectCurrentMigration(ctx context.Context, db dbtx.DBTX) (uint32, error)

func (*Schema) SelectEvents

func (s *Schema) SelectEvents(ctx context.Context, db dbtx.DBTX, streamType string, streamID string, eventNumber int64) (pgx.Rows, error)

func (*Schema) SelectOutboxStreamIDs

func (s *Schema) SelectOutboxStreamIDs(ctx context.Context, db dbtx.DBTX, graceWindow time.Duration, partitions []uint32, token string, limit int) ([]es.StreamReference, error)

func (*Schema) SelectOutboxWatermark

func (s *Schema) SelectOutboxWatermark(ctx context.Context, db dbtx.DBTX, stream es.StreamReference) (OutboxWatermark, int64, error)

func (*Schema) SelectStreamReferences

func (s *Schema) SelectStreamReferences(ctx context.Context, db dbtx.DBTX, streamType string, token string, limit int64) (pgx.Rows, error)

func (*Schema) Unlisten

func (s *Schema) Unlisten(ctx context.Context, db dbtx.DBTX, partitions []uint32) error

func (*Schema) UpdateOutbox

func (s *Schema) UpdateOutbox(ctx context.Context, tx dbtx.DBTX, streamType, streamID string, eventNumber, lastEventNumber int64) (int64, error)

func (*Schema) UpdateOutboxWatermark

func (s *Schema) UpdateOutboxWatermark(ctx context.Context, db dbtx.DBTX, stream es.StreamReference, delay time.Duration, watermark OutboxWatermark) error

func (*Schema) WriteEvent

func (s *Schema) WriteEvent(ctx context.Context, db dbtx.DBTX, event es.Event, content []byte, metadata []byte) error

Jump to

Keyboard shortcuts

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