orville-postgresql-1.0.0.0: A Haskell library for PostgreSQL
CopyrightFlipstone Technology Partners 2023
LicenseMIT
StabilityStable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Orville.PostgreSQL.Execution.Transaction

Description

This module provides the functionality to work with SQL transactions - notably to ensure some Haskell action occurs within a database transaction.

Since: 1.0.0.0

Synopsis

Documentation

withTransaction :: MonadOrville m => m a -> m a Source #

Performs an action in an Orville monad within a database transaction. The transaction is begun before the action is called. If the action completes without raising an exception, the transaction will be committed. If the action raises an exception, the transaction will rollback.

This function is safe to call from within another transaction. When called this way, the transaction will establish a new savepoint at the beginning of the nested transaction and either release the savepoint or rollback to it as appropriate.

Note: Exceptions are handled using the implementations of catch and mask provided by the MonadOrvilleControl instance for m.

Since: 1.0.0.0