stores

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQL

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

func NewMySQL

func NewMySQL(db *sql.DB, opts ...MySQLOption) *MySQL

func (*MySQL) Add

func (s *MySQL) Add(ctx context.Context, exec txoutbox.Executor, msg txoutbox.Message) error

func (*MySQL) Claim

func (s *MySQL) Claim(ctx context.Context, workerID string, limit int, leaseTTL time.Duration) ([]txoutbox.Envelope, error)

func (*MySQL) Fail

func (s *MySQL) Fail(ctx context.Context, id int64, retryCount int) error

func (*MySQL) Retry

func (s *MySQL) Retry(ctx context.Context, id int64, retryCount int, nextRetry time.Time) error

func (*MySQL) Send

func (s *MySQL) Send(ctx context.Context, id int64, sendAt time.Time) error

type MySQLOption

type MySQLOption func(*MySQL)

func WithMySQLNow

func WithMySQLNow(now func() time.Time) MySQLOption

func WithMySQLTable

func WithMySQLTable(table string) MySQLOption

type Postgres

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

func NewPostgres

func NewPostgres(db *sql.DB, opts ...PostgresOption) *Postgres

func (*Postgres) Add

func (s *Postgres) Add(ctx context.Context, exec txoutbox.Executor, msg txoutbox.Message) error

func (*Postgres) Claim

func (s *Postgres) Claim(ctx context.Context, workerID string, limit int, leaseTTL time.Duration) ([]txoutbox.Envelope, error)

func (*Postgres) Fail

func (s *Postgres) Fail(ctx context.Context, id int64, retryCount int) error

func (*Postgres) Retry

func (s *Postgres) Retry(ctx context.Context, id int64, retryCount int, nextRetry time.Time) error

func (*Postgres) Send

func (s *Postgres) Send(ctx context.Context, id int64, sendAt time.Time) error

type PostgresOption

type PostgresOption func(*Postgres)

func WithPostgresNow

func WithPostgresNow(now func() time.Time) PostgresOption

func WithPostgresTable

func WithPostgresTable(table string) PostgresOption

type SQLite

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

SQLite implements Store for SQLite databases.

func NewSQLite

func NewSQLite(db *sql.DB, opts ...SQLiteOption) *SQLite

NewSQLite creates a Store backed by SQLite.

func (*SQLite) Add

func (s *SQLite) Add(ctx context.Context, exec txoutbox.Executor, msg txoutbox.Message) error

Add inserts a new message row within the caller's transaction.

func (*SQLite) Claim

func (s *SQLite) Claim(ctx context.Context, workerID string, limit int, leaseTTL time.Duration) ([]txoutbox.Envelope, error)

Claim leases up to limit rows for the given worker.

func (*SQLite) Fail

func (s *SQLite) Fail(ctx context.Context, id int64, retryCount int) error

Fail marks the row permanently failed.

func (*SQLite) Retry

func (s *SQLite) Retry(ctx context.Context, id int64, retryCount int, nextRetry time.Time) error

Retry schedules the row for another attempt.

func (*SQLite) Send

func (s *SQLite) Send(ctx context.Context, id int64, sendAt time.Time) error

Send marks the row successful.

type SQLiteOption

type SQLiteOption func(*SQLite)

SQLiteOption configures a SQLite.

func WithSQLiteNow

func WithSQLiteNow(now func() time.Time) SQLiteOption

WithSQLiteNow overrides the clock used for Lease timestamps.

func WithSQLiteTable

func WithSQLiteTable(name string) SQLiteOption

WithSQLiteTable overrides the default table name ("txoutbox").

Jump to

Keyboard shortcuts

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