persistence

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEntityNotFound is returned when an entity is not found in the repository.
	ErrEntityNotFound = errors.New("entity not found")

	// ErrOptimisticLocking is returned when an optimistic locking conflict occurs.
	ErrOptimisticLocking = errors.New("optimistic locking error")
)

Functions

func WithTransaction added in v0.2.7

func WithTransaction[T any](ctx context.Context, tm TxManager, fn func(txCtx context.Context) (T, error)) (T, error)

WithTransaction is a generic wrapper around TxManager.WithTransaction that provides type-safe transaction handling without manual type assertions.

Types

type TxManager

type TxManager interface {
	WithTransaction(ctx context.Context, fn func(txCtx context.Context) (any, error)) (any, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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