sql

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sql provides shared building blocks for database/sql-based outbox.Store implementations. Concrete dialect implementations live in subpackages such as outbox/sql/postgres and outbox/sql/sqlite.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ScanMessages

func ScanMessages(rows *sql.Rows) ([]outbox.Message, error)

ScanMessages scans rows produced by a fetch query into outbox.Message values.

The expected column order is:

id, topic, key, payload, headers, status, retries, last_error, created_at, processed_at

processed_at is treated as nullable.

Types

type Config

type Config struct {
	TableName  string
	MaxRetries int
	RetryAfter time.Duration
}

Config holds the configuration shared by database/sql outbox stores.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration used by dialect stores.

type Execer

type Execer interface {
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

Execer is the minimal interface needed to execute a statement. Both *sql.DB, *sql.Tx and *sql.Conn satisfy it.

type Option

type Option interface {
	Apply(*Config)
}

An Option configures a Store instance.

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets the maximum number of retries before a message is marked as failed.

func WithRetryAfter

func WithRetryAfter(d time.Duration) Option

WithRetryAfter sets the duration after which a failed message is retried.

func WithTableName

func WithTableName(s string) Option

WithTableName sets the outbox table name.

type OptionFunc

type OptionFunc func(*Config)

OptionFunc is a function that configures a Store config.

func (OptionFunc) Apply

func (f OptionFunc) Apply(config *Config)

Apply calls f(config).

Directories

Path Synopsis
Package postgres provides a PostgreSQL implementation of outbox.Store using database/sql.
Package postgres provides a PostgreSQL implementation of outbox.Store using database/sql.
Package sqlite provides a SQLite implementation of outbox.Store using database/sql.
Package sqlite provides a SQLite implementation of outbox.Store using database/sql.

Jump to

Keyboard shortcuts

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