Safe Haskell | None |
---|---|
Language | Haskell2010 |
Database.Persist.Monad.Internal.SqlTransaction
Synopsis
- newtype SqlTransaction (m :: Type -> Type) a = UnsafeSqlTransaction {}
- data SqlTransactionEnv = SqlTransactionEnv {
- sqlBackend :: SqlBackend
- ignoreCatch :: SomeException -> Bool
- runSqlTransaction :: MonadUnliftIO m => SqlTransactionEnv -> SqlTransaction m a -> m a
- catchSqlTransaction :: forall (m :: Type -> Type) e a. (MonadUnliftIO m, Exception e) => SqlTransaction m a -> (e -> SqlTransaction m a) -> SqlTransaction m a
Documentation
newtype SqlTransaction (m :: Type -> Type) a Source #
The monad that tracks transaction state.
Conceptually equivalent to SqlPersistT
, but restricts
IO operations, for two reasons:
- Forking a thread that uses the same
SqlBackend
as the current thread causes Bad Things to happen. - Transactions may need to be retried, in which case IO operations in a transaction are required to be rerunnable.
You shouldn't need to explicitly use this type; your functions should only
declare the MonadSqlQuery
constraint.
Constructors
UnsafeSqlTransaction | |
Fields |
Instances
data SqlTransactionEnv Source #
Constructors
SqlTransactionEnv | |
Fields
|
runSqlTransaction :: MonadUnliftIO m => SqlTransactionEnv -> SqlTransaction m a -> m a Source #
catchSqlTransaction :: forall (m :: Type -> Type) e a. (MonadUnliftIO m, Exception e) => SqlTransaction m a -> (e -> SqlTransaction m a) -> SqlTransaction m a Source #
Like normal catch
, except ignores errors specified by ignoreCatch
.