operation

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package operation provides transaction-scoped idempotency receipts. A caller holds its domain lock before reading or storing a receipt; retries return the original result, and reusing a key with different input is rejected.

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyRequired = errors.New("request_id must contain 1–128 non-whitespace characters")
View Source
var ErrKeyReuse = errors.New("request_id was already used with different parameters")

Functions

func Replay

func Replay(ctx context.Context, tx *sql.Tx, scope, key string, input, output any) (bool, error)

func Save

func Save(ctx context.Context, tx *sql.Tx, scope, key string, input, output any) error

func ValidateKey

func ValidateKey(key string) error

Types

type Error

type Error struct {
	Code            string `json:"code"`
	Message         string `json:"message"`
	NextAction      string `json:"next_action"`
	CurrentRevision int64  `json:"current_revision,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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