Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
-
data
SqlBackend
=
SqlBackend
{
- connPrepare :: Text -> IO Statement
- connInsertSql :: EntityDef -> [ PersistValue ] -> InsertSqlResult
- connInsertManySql :: Maybe ( EntityDef -> [[ PersistValue ]] -> InsertSqlResult )
- connUpsertSql :: Maybe ( EntityDef -> NonEmpty ( FieldNameHS , FieldNameDB ) -> Text -> Text )
- connPutManySql :: Maybe ( EntityDef -> Int -> Text )
- connStmtMap :: StatementCache
- connClose :: IO ()
- connMigrateSql :: [ EntityDef ] -> ( Text -> IO Statement ) -> EntityDef -> IO ( Either [ Text ] [( Bool , Text )])
- connBegin :: ( Text -> IO Statement ) -> Maybe IsolationLevel -> IO ()
- connCommit :: ( Text -> IO Statement ) -> IO ()
- connRollback :: ( Text -> IO Statement ) -> IO ()
- connEscapeFieldName :: FieldNameDB -> Text
- connEscapeTableName :: EntityDef -> Text
- connEscapeRawName :: Text -> Text
- connNoLimit :: Text
- connRDBMS :: Text
- connLimitOffset :: ( Int , Int ) -> Text -> Text
- connLogFunc :: LogFunc
- connMaxParams :: Maybe Int
- connRepsertManySql :: Maybe ( EntityDef -> Int -> Text )
- connVault :: Vault
- connHooks :: SqlBackendHooks
-
newtype
SqlBackendHooks
=
SqlBackendHooks
{
- hookGetStatement :: SqlBackend -> Text -> Statement -> IO Statement
- emptySqlBackendHooks :: SqlBackendHooks
- mkSqlBackend :: MkSqlBackendArgs -> SqlBackend
Documentation
data SqlBackend Source #
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
, known as a
Pool
SqlBackend
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.
SqlBackend | |
|
Instances
newtype SqlBackendHooks Source #
SqlBackendHooks | |
|
mkSqlBackend :: MkSqlBackendArgs -> SqlBackend Source #
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.
Since: 2.13.0.0