| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Database.PostgreSQL.Tx.Simple
Synopsis
- type PgSimpleEnv r = TxEnv Connection r :: Constraint
- type PgSimpleM a = forall r. PgSimpleEnv r => TxM r a
- withTransaction :: (PgSimpleEnv r, HasCallStack) => r -> (HasCallStack => TxM r a) -> IO a
- withTransactionLevel :: (PgSimpleEnv r, HasCallStack) => IsolationLevel -> r -> (HasCallStack => TxM r a) -> IO a
- withTransactionMode :: (PgSimpleEnv r, HasCallStack) => TransactionMode -> r -> (HasCallStack => TxM r a) -> IO a
- withTransactionSerializable :: (PgSimpleEnv r, HasCallStack) => r -> (HasCallStack => TxM r a) -> IO a
- withTransactionModeRetry :: (Exception e, PgSimpleEnv r, HasCallStack) => TransactionMode -> (e -> Bool) -> r -> (HasCallStack => TxM r a) -> IO a
- query :: (ToRow q, FromRow x) => Query -> q -> PgSimpleM [x]
- query_ :: FromRow x => Query -> PgSimpleM [x]
- execute :: ToRow q => Query -> q -> PgSimpleM Int64
- execute_ :: Query -> PgSimpleM Int64
Documentation
type PgSimpleEnv r = TxEnv Connection r :: Constraint Source #
Runtime environment needed to run postgresql-simple via postgresql-tx.
Since: 0.2.0.0
type PgSimpleM a = forall r. PgSimpleEnv r => TxM r a Source #
Monad type alias for running postgresql-simple via postgresql-tx.
Since: 0.2.0.0
withTransaction :: (PgSimpleEnv r, HasCallStack) => r -> (HasCallStack => TxM r a) -> IO a Source #
Analogue of withTransaction.
Since: 0.1.0.0
withTransactionLevel :: (PgSimpleEnv r, HasCallStack) => IsolationLevel -> r -> (HasCallStack => TxM r a) -> IO a Source #
Analogue of withTransactionLevel.
Since: 0.1.0.0
withTransactionMode :: (PgSimpleEnv r, HasCallStack) => TransactionMode -> r -> (HasCallStack => TxM r a) -> IO a Source #
Analogue of withTransactionMode.
Since: 0.2.0.0
withTransactionSerializable :: (PgSimpleEnv r, HasCallStack) => r -> (HasCallStack => TxM r a) -> IO a Source #
Analogue of withTransactionSerializable.
Unlike postgresql-simple, uses shouldRetryTx to also retry
on deadlock_detected, not just serialization_failure.
Note that any IO that occurs inside the TxM may be executed multiple times.
Since: 0.2.0.0
withTransactionModeRetry :: (Exception e, PgSimpleEnv r, HasCallStack) => TransactionMode -> (e -> Bool) -> r -> (HasCallStack => TxM r a) -> IO a Source #
Analogue of withTransactionModeRetry.
You should generally prefer withTransactionSerializable.
Note that any IO that occurs inside the TxM may be executed multiple times.
Since: 0.2.0.0