tx

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package tx provides transactional interfaces for atomic storage operations. It supports conditional execution with predicates for complex transaction logic.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestResponse

type RequestResponse struct {
	// Values contains the result data for Get operations.
	Values []kv.KeyValue
}

RequestResponse represents the response for an individual transaction operation.

type Response

type Response struct {
	// Succeeded indicates whether the transaction predicates evaluated to true.
	Succeeded bool
	// Results contains the responses for each operation in Then/Else blocks.
	Results []RequestResponse
}

Response contains the result of a transaction execution.

type Tx

type Tx interface {
	// If specifies predicates for conditional transaction execution.
	// Empty predicate list means always true (unconditional execution).
	If(predicates ...predicate.Predicate) Tx
	// Then specifies operations to execute if predicates evaluate to true.
	// At least one Then call is required.
	Then(operations ...operation.Operation) Tx
	// Else specifies operations to execute if predicates evaluate to false.
	// This is optional.
	Else(operations ...operation.Operation) Tx
	// Commit atomically executes the transaction and returns the result.
	Commit() (Response, error)
}

Tx represents a transactional interface for atomic operations. Transactions support conditional execution with predicates.

Jump to

Keyboard shortcuts

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