transaction

package
v0.0.0-...-9b56418 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package transaction contains interfaces and business logic for managing transactions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatabaseTransactionTimeout

func DatabaseTransactionTimeout() time.Duration

func SetDatabaseTransactionTimeout

func SetDatabaseTransactionTimeout(t time.Duration)

func Transactional

func Transactional(tm TransactionManager, todo func(f TransactionalResources) error) error

Transactional executes the given function in a transaction. If todo returns an error, the transaction is rolled back

Types

type Transaction

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

Transaction represents an existing transaction. It provides access to transactional resources, plus methods to commit or roll back the transaction

type TransactionManager

type TransactionManager interface {
	BeginTransaction() (Transaction, error)
}

TransactionManager manages the lifecycle of a database transaction. The transactional resources (such as repositories) created for the transaction object make changes inside the transaction

type TransactionalResources

type TransactionalResources interface {
	repository.Repositories
}

TransactionalResources provides a reference to transactional resources available during a transaction

Jump to

Keyboard shortcuts

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