tx

package
v0.51.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDiscarded is returned if the transaction was already discarded or committed.
	ErrDiscarded = errors.New("transaction has already been discarded or committed")
	// ErrNotWrite is returned if the transaction is read only.
	ErrNotWrite = errors.New("transaction is read-only")
)

Functions

This section is empty.

Types

type Tx

type Tx interface {
	// Commit commits the transaction to storage.
	// Can return an error to indicate tx failure.
	Commit(ctx context.Context) error
	// Discard cancels the transaction.
	// If called after Commit, does nothing.
	// Cannot return an error.
	// Can be called unlimited times.
	// Always call Discard or Commit when done with a tx.
	Discard()
}

Tx is a generic transaction interface.

Jump to

Keyboard shortcuts

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