hpqtypes
Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.PQTypes.Transaction.Settings

Synopsis

Documentation

data RestartPredicate Source #

Predicate that determines whether the transaction has to be restarted.

Constructors

Exception e => RestartPredicate (e -> Integer -> Bool) 

data TransactionSettings Source #

Constructors

TransactionSettings 

Fields

  • tsRestartPredicate :: !(Maybe RestartPredicate)

    Defines behavior of withTransaction in case exceptions thrown within supplied monadic action are not caught and reach its body.

    If set to Nothing, exceptions will be propagated as usual.

    If set to Just f, exceptions will be intercepted and passed to f along with a number that indicates how many times the transaction block already failed.

    If f returns True, the transaction is restarted. Otherwise the exception is further propagated. This allows for restarting transactions e.g. in case of serialization failure. It is up to the caller to ensure that is it safe to execute supplied monadic action multiple times.

  • tsConnectionAcquisitionMode :: !ConnectionAcquisitionMode

    Acquisition mode of a database connection.

data ConnectionAcquisitionMode Source #

Acquisition mode of a database connection.

Constructors

AcquireOnDemand

Acquire a connection on demand, i.e. only when a query needs to be run. This mode enables you to have a MonadDB constraint in scope without keeping a transaction open, but is limited to executionn of read only queries.

AcquireAndHold !IsolationLevel !Permissions

Acquire a connection, start a transaction with a given isolation level and permissions and hold onto it for the duration of a MonadDB constraint in scope.

defaultTransactionSettings :: TransactionSettings Source #

Default transaction settings.