eventpg

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package eventpg implements the abstract types for PostgreSQL

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LockOrError

func LockOrError[TX eventmodels.AbstractTX, DB eventmodels.CanTransact[TX]](ctx context.Context, db DB, key uint32, timeout time.Duration) (unlock func() error, err error)

func MarkEventProcessed

func MarkEventProcessed[TX eventmodels.AbstractTX](ctx context.Context, tx TX, topic string, source string, id string, handlerName string) error

func Migrations

func Migrations(database *libschema.Database)

func ProduceDroppedTxEvents

func ProduceDroppedTxEvents[TX eventmodels.AbstractTX, DB eventmodels.CanTransact[TX]](ctx context.Context, db DB, batchSize int, producer eventmodels.Producer[eventmodels.StringEventID, TX]) (int, error)

func SaveEventsInsideTx

func SaveEventsInsideTx[TX eventmodels.AbstractTX](ctx context.Context, backupTracer eventmodels.Tracer, tx TX, optProducer eventmodels.Producer[eventmodels.StringEventID, TX], events ...eventmodels.ProducingEvent) (map[string][]eventmodels.StringEventID, error)

SaveEventsInsideTx is meant to be used inside a transaction to persist events as part of that transaction. backupTracer is unused if producer is provided. topics are unvalidated if optProducer is not provided.

Types

type Connection

type Connection[TX eventdb.BasicTX, DB eventdb.BasicDB[TX]] struct {
	eventdb.BasicDB[TX]
	// contains filtered or unexported fields
}

func New

func New[TX eventdb.BasicTX, DB eventdb.BasicDB[TX]](db DB) *Connection[TX, DB]

func (*Connection[TX, DB]) AugmentWithProducer

func (w *Connection[TX, DB]) AugmentWithProducer(producer eventmodels.Producer[eventmodels.StringEventID, TX])

func (*Connection[TX, DB]) LockOrError

func (c *Connection[TX, DB]) LockOrError(ctx context.Context, key uint32, timeout time.Duration) (unlock func() error, err error)

func (Connection[TX, DB]) MarkEventProcessed

func (c Connection[TX, DB]) MarkEventProcessed(ctx context.Context, tx TX, topic string, source string, id string, handlerName string) error

func (*Connection[TX, DB]) ProduceDroppedTxEvents

func (c *Connection[TX, DB]) ProduceDroppedTxEvents(ctx context.Context, batchSize int) (int, error)

func (*Connection[TX, DB]) ProduceSpecificTxEvents

func (c *Connection[TX, DB]) ProduceSpecificTxEvents(ctx context.Context, ids []eventmodels.StringEventID) (int, error)

func (Connection[TX, DB]) SaveEventsInsideTx

func (c Connection[TX, DB]) SaveEventsInsideTx(ctx context.Context, tx TX, events ...eventmodels.ProducingEvent) (map[string][]eventmodels.StringEventID, error)

func (*Connection[TX, DB]) Transact

func (c *Connection[TX, DB]) Transact(ctx context.Context, f func(TX) error) error

Jump to

Keyboard shortcuts

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