HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulepersistent-2.14.6.3Haskell2010

Database.Persist.SqlBackend

This module contains types and information necessary for a SQL database. Database support libraries, like persistent-postgresql, will be responsible for constructing these values.

  • 3 types
  • 18 values

The type and construction

5 declarations
datadata SqlBackend
#

A SqlBackend represents a handle or connection to a database. It contains functions and values that allow databases to have more optimized implementations, as well as references that benefit performance and sharing.

Instead of using the SqlBackend constructor directly, use the mkSqlBackend function.

A SqlBackend is *not* thread-safe. You should not assume that a SqlBackend can be shared among threads and run concurrent queries. This *will* result in problems. Instead, you should create a Pool SqlBackend, known as a ConnectionPool, and pass that around in multi-threaded applications.

To run actions in the persistent library, you should use the runSqlConn function. If you're using a multithreaded application, use the runSqlPool function.

Instances32PersistQueryRead, PersistQueryWrite, HasPersistBackend, IsPersistBackend, PersistCore, PersistStoreRead, …

A function for creating a value of the SqlBackend type. You should prefer to use this instead of the constructor for SqlBackend, because default values for this will be provided for new fields on the record when new functionality is added.

datadata MkSqlBackendArgs
#

This type shares many of the same field names as the SqlBackend type. It's useful for library authors to use this when migrating from using the SqlBackend constructor directly to the mkSqlBackend function.

This type will only contain required fields for constructing a SqlBackend. For fields that aren't present on this record, you'll want to use the various set functions or

Constructors

Utilities

0 declarations

The functions exported here are a bit more general than the record accessors. The easiest way to use them is to provide the SqlBackend directly to the function. However, you can also use them in a ReaderT context, and you can even use them with any backend type tht has a BackendCompatible SqlBackend backend instance.

SqlBackend Getters

SqlBackend Setters

Set the maximum parameters that may be issued in a given SQL query. This should be used only if the database backend have this limitation.

SqlBackendHooks