Copyright | Flipstone Technology Partners 2023 |
---|---|
License | MIT |
Stability | Stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- withTransaction :: MonadOrville m => m a -> m a
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