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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Database.Persist.SqlBackend.Internal.SqlPoolHooks

Synopsis

- data SqlPoolHooks (m :: Type -> Type) backend = SqlPoolHooks {
  - alterBackend :: backend -> m backend
  - runBefore :: backend -> Maybe IsolationLevel -> m ()
  - runAfter :: backend -> Maybe IsolationLevel -> m ()
  - runOnException :: backend -> Maybe IsolationLevel -> SomeException -> m ()
  }

# Documentation

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

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

Constructors

SqlPoolHooks |

Fields

- alterBackend :: backend -> m backend

  Alter the backend prior to executing any actions with it.

- runBefore :: backend -> Maybe IsolationLevel -> m ()

  Run this action immediately before the action is performed.

- runAfter :: backend -> Maybe IsolationLevel -> m ()

  Run this action immediately after the action is completed.

- runOnException :: backend -> Maybe IsolationLevel -> SomeException -> m ()

  This action is performed when an exception is received. The exception is provided as a convenience - it is rethrown once this cleanup function is complete.