Database.Persist.SqlBackend.SqlPoolHooks

persistent-2.14.6.3: Type-safe, multi-backend data serialization.

Safe Haskell | None
Language | Haskell2010

Database.Persist.SqlBackend.SqlPoolHooks

Synopsis

- data SqlPoolHooks (m :: Type -> Type) backend
- defaultSqlPoolHooks :: forall (m :: Type -> Type) backend. (MonadIO m, BackendCompatible SqlBackend backend) => SqlPoolHooks m backend
- getAlterBackend :: SqlPoolHooks m backend -> backend -> m backend
- modifyAlterBackend :: SqlPoolHooks m backend -> ((backend -> m backend) -> backend -> m backend) -> SqlPoolHooks m backend
- setAlterBackend :: SqlPoolHooks m backend -> (backend -> m backend) -> SqlPoolHooks m backend
- getRunBefore :: SqlPoolHooks m backend -> backend -> Maybe IsolationLevel -> m ()
- modifyRunBefore :: SqlPoolHooks m backend -> ((backend -> Maybe IsolationLevel -> m ()) -> backend -> Maybe IsolationLevel -> m ()) -> SqlPoolHooks m backend
- setRunBefore :: SqlPoolHooks m backend -> (backend -> Maybe IsolationLevel -> m ()) -> SqlPoolHooks m backend
- getRunAfter :: SqlPoolHooks m backend -> backend -> Maybe IsolationLevel -> m ()
- modifyRunAfter :: SqlPoolHooks m backend -> ((backend -> Maybe IsolationLevel -> m ()) -> backend -> Maybe IsolationLevel -> m ()) -> SqlPoolHooks m backend
- setRunAfter :: SqlPoolHooks m backend -> (backend -> Maybe IsolationLevel -> m ()) -> SqlPoolHooks m backend
- getRunOnException :: SqlPoolHooks m backend -> backend -> Maybe IsolationLevel -> SomeException -> m ()

# Documentation

data SqlPoolHooks (m :: Type -> Type) backend #

A set of hooks that may be used to alter the behaviour of `runSqlPoolWithExtensibleHooks` in a backwards-compatible fashion.

defaultSqlPoolHooks :: forall (m :: Type -> Type) backend. (MonadIO m, BackendCompatible SqlBackend backend) => SqlPoolHooks m backend #

Lifecycle hooks that may be altered to extend SQL pool behavior in a backwards compatible fashion.

By default, the hooks have the following semantics:

- `alterBackend` has no effect
- `runBefore` begins a transaction
- `runAfter` commits the current transaction
- `runOnException` rolls back the current transaction

Since: 2.13.3.0

getAlterBackend :: SqlPoolHooks m backend -> backend -> m backend #

modifyAlterBackend :: SqlPoolHooks m backend -> ((backend -> m backend) -> backend -> m backend) -> SqlPoolHooks m backend #

setAlterBackend :: SqlPoolHooks m backend -> (backend -> m backend) -> SqlPoolHooks m backend #

getRunBefore :: SqlPoolHooks m backend -> backend -> Maybe IsolationLevel -> m () #

modifyRunBefore :: SqlPoolHooks m backend -> ((backend -> Maybe IsolationLevel -> m ()) -> backend -> Maybe IsolationLevel -> m ()) -> SqlPoolHooks m backend #

setRunBefore :: SqlPoolHooks m backend -> (backend -> Maybe IsolationLevel -> m ()) -> SqlPoolHooks m backend #

getRunAfter :: SqlPoolHooks m backend -> backend -> Maybe IsolationLevel -> m () #

modifyRunAfter :: SqlPoolHooks m backend -> ((backend -> Maybe IsolationLevel -> m ()) -> backend -> Maybe IsolationLevel -> m ()) -> SqlPoolHooks m backend #

setRunAfter :: SqlPoolHooks m backend -> (backend -> Maybe IsolationLevel -> m ()) -> SqlPoolHooks m backend #

getRunOnException :: SqlPoolHooks m backend -> backend -> Maybe IsolationLevel -> SomeException -> m () #