transaction

package
v0.0.0-...-c64bf0e Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package transaction provides support for database transaction related functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteUnderTransaction

func ExecuteUnderTransaction(ctx context.Context, log *logger.Logger, bgn Beginner, fn func(tx Transaction) error) error

ExecuteUnderTransaction is a helper function that can be used in tests and other apps to execute the core APIs under a transaction.

func Set

Set stores a value that can manage a transaction.

Types

type Beginner

type Beginner interface {
	Begin() (Transaction, error)
}

Beginner represents a value that can begin a transaction.

type Transaction

type Transaction interface {
	Commit() error
	Rollback() error
}

Transaction represents a value that can commit or rollback a transaction.

func Get

func Get(ctx context.Context) (Transaction, bool)

Get retrieves the value that can manage a transaction.

Jump to

Keyboard shortcuts

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