idempotencyoutbox

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package idempotencyoutbox coordinates a transactional outbox insert with PostgreSQL idempotency completion in one caller-owned transaction.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertAndComplete

func InsertAndComplete[E any](
	ctx context.Context,
	tx pgx.Tx,
	writer Writer[E],
	envelope E,
	completer Completer,
	request idempotency.CompleteRequest,
) (idempotency.Record, error)

InsertAndComplete inserts envelope and then conditionally completes the idempotency record using tx. The caller must roll back on any returned error and remains responsible for committing a successful transaction.

Types

type Completer

type Completer interface {
	CompleteTx(
		context.Context,
		pgx.Tx,
		idempotency.CompleteRequest,
	) (idempotency.Record, error)
}

Completer conditionally persists idempotency completion in a caller-owned transaction. The idempotency postgres.Store satisfies this contract.

type Writer

type Writer[E any] interface {
	Insert(context.Context, pgx.Tx, E) error
}

Writer inserts an envelope through a caller-owned transaction. The outbox postgres.Writer satisfies Writer[outbox.Envelope].

Jump to

Keyboard shortcuts

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