Documentation
¶
Overview ¶
Package postgres provides a PostgreSQL implementation of outbox.Store using database/sql. Use it with any PostgreSQL-compatible driver (lib/pq, jackc/pgx/v5/stdlib, etc.).
Index ¶
- func CreateTableSQL(tableName string) string
- func Migrate(ctx context.Context, db osql.Execer, tableName string) error
- type Store
- func (s *Store) FetchPending(ctx context.Context, limit int) ([]outbox.Message, error)
- func (s *Store) MarkFailed(ctx context.Context, id string, err error) error
- func (s *Store) MarkProcessed(ctx context.Context, ids ...string) error
- func (s *Store) Save(ctx context.Context, tx any, msgs ...outbox.Message) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTableSQL ¶
CreateTableSQL returns the PostgreSQL DDL for creating the outbox messages table.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements outbox.Store for PostgreSQL.
func (*Store) FetchPending ¶
FetchPending atomically claims up to limit pending messages for processing using FOR UPDATE SKIP LOCKED so concurrent workers don't collide.
func (*Store) MarkFailed ¶
MarkFailed increments retries and records the error. Sets status to failed when max retries reached, else back to pending.
func (*Store) MarkProcessed ¶
MarkProcessed marks messages as successfully processed.
Click to show internal directories.
Click to hide internal directories.