| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Database.Persist.Monad.Internal.SqlTransaction
Synopsis
- newtype SqlTransaction m a = UnsafeSqlTransaction {}
- data SqlTransactionEnv = SqlTransactionEnv {
- sqlBackend :: SqlBackend
- ignoreCatch :: SomeException -> Bool
- runSqlTransaction :: MonadUnliftIO m => SqlTransactionEnv -> SqlTransaction m a -> m a
- catchSqlTransaction :: (MonadUnliftIO m, Exception e) => SqlTransaction m a -> (e -> SqlTransaction m a) -> SqlTransaction m a
Documentation
newtype SqlTransaction m 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
SqlBackendas 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 :: (MonadUnliftIO m, Exception e) => SqlTransaction m a -> (e -> SqlTransaction m a) -> SqlTransaction m a Source #
Like normal catch, except ignores errors specified by ignoreCatch.