-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | This package includes a thin sqlite3 wrapper based on the
--   direct-sqlite package, as well as the entire C library, so there are
--   no system dependencies.
@package persistent-sqlite
@version 2.13.3.1


-- | Utterly unsafe internals of the <a>Database.Sqlite</a> module. Useful
--   for people who want access to the SQLite database pointer to manually
--   call SQLite API functions via the FFI.
--   
--   Types and functions in this module are *NOT* covered by the PVP and
--   may change breakingly in any future version of the package.
module Database.Sqlite.Internal

-- | SQLite connection type, consist of an IORef tracking whether the
--   connection has been closed and the raw SQLite C API pointer, wrapped
--   in a 'Connection'' newtype.
data Connection
Connection :: !IORef Bool -> Connection' -> Connection

-- | Newtype wrapping SQLite C API pointer for a database connection.
newtype Connection'
Connection' :: Ptr () -> Connection'

-- | Newtype wrapping SQLite C API pointer for a prepared statement.
newtype Statement
Statement :: Ptr () -> Statement


-- | A port of the direct-sqlite package for dealing directly with
--   <a>PersistValue</a>s.
module Database.Sqlite

-- | SQLite connection type, consist of an IORef tracking whether the
--   connection has been closed and the raw SQLite C API pointer, wrapped
--   in a 'Connection'' newtype.
data Connection

-- | Newtype wrapping SQLite C API pointer for a prepared statement.
data Statement
data Error
ErrorOK :: Error
ErrorError :: Error
ErrorInternal :: Error
ErrorPermission :: Error
ErrorAbort :: Error
ErrorBusy :: Error
ErrorLocked :: Error
ErrorNoMemory :: Error
ErrorReadOnly :: Error
ErrorInterrupt :: Error
ErrorIO :: Error
ErrorNotFound :: Error
ErrorCorrupt :: Error
ErrorFull :: Error
ErrorCan'tOpen :: Error
ErrorProtocol :: Error
ErrorEmpty :: Error
ErrorSchema :: Error
ErrorTooBig :: Error
ErrorConstraint :: Error
ErrorMismatch :: Error
ErrorMisuse :: Error
ErrorNoLargeFileSupport :: Error
ErrorAuthorization :: Error
ErrorFormat :: Error
ErrorRange :: Error
ErrorNotAConnection :: Error
ErrorRow :: Error
ErrorDone :: Error

-- | A custom exception type to make it easier to catch exceptions.
data SqliteException
SqliteException :: !Error -> !Text -> !Text -> SqliteException
[seError] :: SqliteException -> !Error
[seFunctionName] :: SqliteException -> !Text
[seDetails] :: SqliteException -> !Text
data StepResult
Row :: StepResult
Done :: StepResult

-- | Configuration option for SQLite to be used together with the
--   <a>config</a> function.
data Config

-- | A function to be used for logging
ConfigLogFn :: LogFunction -> Config

data LogFunction

-- | Return type of the <a>status</a> function
data SqliteStatus
SqliteStatus :: Maybe Int -> Maybe Int -> SqliteStatus

-- | The current value of the parameter. Some parameters do not record
--   current value.
[sqliteStatusCurrent] :: SqliteStatus -> Maybe Int

-- | The highest recorded value. Some parameters do not record the highest
--   value.
[sqliteStatusHighwater] :: SqliteStatus -> Maybe Int

-- | Run-time status parameter that can be returned by <a>status</a>
--   function.
data SqliteStatusVerb

-- | This parameter is the current amount of memory checked out using
--   sqlite3_malloc(), either directly or indirectly. The figure includes
--   calls made to sqlite3_malloc() by the application and internal memory
--   usage by the SQLite library. Scratch memory controlled by
--   SQLITE_CONFIG_SCRATCH and auxiliary page-cache memory controlled by
--   SQLITE_CONFIG_PAGECACHE is not included in this parameter. The amount
--   returned is the sum of the allocation sizes as reported by the xSize
--   method in sqlite3_mem_methods.
SqliteStatusMemoryUsed :: SqliteStatusVerb

-- | This parameter returns the number of pages used out of the pagecache
--   memory allocator that was configured using SQLITE_CONFIG_PAGECACHE.
--   The value returned is in pages, not in bytes.
SqliteStatusPagecacheUsed :: SqliteStatusVerb

-- | This parameter returns the number of bytes of page cache allocation
--   which could not be satisfied by the SQLITE_CONFIG_PAGECACHE buffer and
--   where forced to overflow to sqlite3_malloc(). The returned value
--   includes allocations that overflowed because they where too large
--   (they were larger than the "sz" parameter to SQLITE_CONFIG_PAGECACHE)
--   and allocations that overflowed because no space was left in the page
--   cache.
SqliteStatusPagecacheOverflow :: SqliteStatusVerb

-- | This parameter returns the number of allocations used out of the
--   scratch memory allocator configured using SQLITE_CONFIG_SCRATCH. The
--   value returned is in allocations, not in bytes. Since a single thread
--   may only have one scratch allocation outstanding at time, this
--   parameter also reports the number of threads using scratch memory at
--   the same time.
SqliteStatusScratchUsed :: SqliteStatusVerb

-- | This parameter returns the number of bytes of scratch memory
--   allocation which could not be satisfied by the SQLITE_CONFIG_SCRATCH
--   buffer and where forced to overflow to sqlite3_malloc(). The values
--   returned include overflows because the requested allocation was too
--   larger (that is, because the requested allocation was larger than the
--   "sz" parameter to SQLITE_CONFIG_SCRATCH) and because no scratch buffer
--   slots were available.
SqliteStatusScratchOverflow :: SqliteStatusVerb

-- | This parameter records the largest memory allocation request handed to
--   sqlite3_malloc() or sqlite3_realloc() (or their internal equivalents).
--   Only the value returned in <a>sqliteStatusHighwater</a> field of
--   <a>SqliteStatus</a> record is of interest. The value written into the
--   <a>sqliteStatusCurrent</a> field is Nothing.
SqliteStatusMallocSize :: SqliteStatusVerb

-- | This parameter records the largest memory allocation request handed to
--   pagecache memory allocator. Only the value returned in the
--   <a>sqliteStatusHighwater</a> field of <a>SqliteStatus</a> record is of
--   interest. The value written into the <a>sqliteStatusCurrent</a> field
--   is Nothing.
SqliteStatusPagecacheSize :: SqliteStatusVerb

-- | This parameter records the largest memory allocation request handed to
--   scratch memory allocator. Only the value returned in the
--   <a>sqliteStatusHighwater</a> field of <a>SqliteStatus</a> record is of
--   interest. The value written into the <a>sqliteStatusCurrent</a> field
--   is Nothing.
SqliteStatusScratchSize :: SqliteStatusVerb

-- | This parameter records the number of separate memory allocations
--   currently checked out.
SqliteStatusMallocCount :: SqliteStatusVerb
open :: Text -> IO Connection

-- | Like <a>open</a>, but accepts a <tt>ByteString</tt> instead of a
--   <a>Text</a>.
open' :: ByteString -> IO Connection
close :: Connection -> IO ()
prepare :: Connection -> Text -> IO Statement

-- | Execute a database statement. It's recommended to use <a>stepConn</a>
--   instead, because it gives better error messages.
step :: Statement -> IO StepResult

-- | Execute a database statement. This function uses the <a>Connection</a>
--   passed to it to give better error messages than <a>step</a>.
stepConn :: Connection -> Statement -> IO StepResult
reset :: Connection -> Statement -> IO ()
finalize :: Statement -> IO ()
bindBlob :: Statement -> Int -> ByteString -> IO ()
bindDouble :: Statement -> Int -> Double -> IO ()
bindInt :: Statement -> Int -> Int -> IO ()
bindInt64 :: Statement -> Int -> Int64 -> IO ()
bindNull :: Statement -> Int -> IO ()
bindText :: Statement -> Int -> Text -> IO ()
bind :: Statement -> [PersistValue] -> IO ()
column :: Statement -> Int -> IO PersistValue
columns :: Statement -> IO [PersistValue]
changes :: Connection -> IO Int64

-- | Wraps a given function to a <a>LogFunction</a> to be further used with
--   <a>ConfigLogFn</a>. First argument of given function will take error
--   code, second - log message. Returned value should be released with
--   <a>freeLogFunction</a> when no longer required.
mkLogFunction :: (Int -> String -> IO ()) -> IO LogFunction

-- | Releases a native FunPtr for the <a>LogFunction</a>.
freeLogFunction :: LogFunction -> IO ()

-- | Sets SQLite global configuration parameter. See SQLite documentation
--   for the <a>sqlite3_config</a> function. In short, this must be called
--   prior to any other SQLite function if you want the call to succeed.
config :: Config -> IO ()

-- | Retrieves runtime status information about the performance of SQLite,
--   and optionally resets various highwater marks. The first argument is a
--   status parameter to measure, the second is reset flag. If reset flag
--   is True then the highest recorded value is reset after being returned
--   from this function.
status :: SqliteStatusVerb -> Bool -> IO SqliteStatus

-- | Sets and/or queries the soft limit on the amount of heap memory that
--   may be allocated by SQLite. If the argument is zero then the soft heap
--   limit is disabled. If the argument is negative then no change is made
--   to the soft heap limit. Hence, the current size of the soft heap limit
--   can be determined by invoking this function with a negative argument.
softHeapLimit :: Int64 -> IO Int64
enableExtendedResultCodes :: Connection -> IO ()
disableExtendedResultCodes :: Connection -> IO ()
instance GHC.Classes.Eq Database.Sqlite.ColumnType
instance GHC.Classes.Eq Database.Sqlite.Error
instance GHC.Classes.Eq Database.Sqlite.SqliteStatus
instance GHC.Classes.Eq Database.Sqlite.StepResult
instance GHC.Internal.Exception.Type.Exception Database.Sqlite.SqliteException
instance GHC.Internal.Show.Show Database.Sqlite.ColumnType
instance GHC.Internal.Show.Show Database.Sqlite.Error
instance GHC.Internal.Show.Show Database.Sqlite.SqliteException
instance GHC.Internal.Show.Show Database.Sqlite.SqliteStatus
instance GHC.Internal.Show.Show Database.Sqlite.StepResult


-- | A sqlite backend for persistent.
--   
--   Note: If you prepend <tt>WAL=off </tt> to your connection string, it
--   will disable the write-ahead log. This functionality is now deprecated
--   in favour of using SqliteConnectionInfo.
module Database.Persist.Sqlite

-- | Run the given action with a connection pool.
--   
--   Like <a>createSqlitePool</a>, this should not be used with
--   <tt>:memory:</tt>.
withSqlitePool :: (MonadUnliftIO m, MonadLoggerIO m) => Text -> Int -> (Pool SqlBackend -> m a) -> m a

-- | Run the given action with a connection pool.
--   
--   Like <a>createSqlitePool</a>, this should not be used with
--   <tt>:memory:</tt>.
withSqlitePoolInfo :: (MonadUnliftIO m, MonadLoggerIO m) => SqliteConnectionInfo -> Int -> (Pool SqlBackend -> m a) -> m a
withSqliteConn :: (MonadUnliftIO m, MonadLoggerIO m) => Text -> (SqlBackend -> m a) -> m a

withSqliteConnInfo :: (MonadUnliftIO m, MonadLoggerIO m) => SqliteConnectionInfo -> (SqlBackend -> m a) -> m a

-- | Create a pool of SQLite connections.
--   
--   Note that this should not be used with the <tt>:memory:</tt>
--   connection string, as the pool will regularly remove connections,
--   destroying your database. Instead, use <a>withSqliteConn</a>.
createSqlitePool :: (MonadLoggerIO m, MonadUnliftIO m) => Text -> Int -> m (Pool SqlBackend)

-- | Create a pool of SQLite connections.
--   
--   Note that this should not be used with the <tt>:memory:</tt>
--   connection string, as the pool will regularly remove connections,
--   destroying your database. Instead, use <a>withSqliteConn</a>.
createSqlitePoolFromInfo :: (MonadLoggerIO m, MonadUnliftIO m) => SqliteConnectionInfo -> Int -> m (Pool SqlBackend)

-- | Create a pool of SQLite connections.
createSqlitePoolWithConfig :: (MonadUnliftIO m, MonadLoggerIO m) => Text -> ConnectionPoolConfig -> m (Pool SqlBackend)
(!=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
(*=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
(+=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
(-=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
(/<-.) :: forall v typ. PersistField typ => EntityField v typ -> [typ] -> Filter v
(/=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
(<-.) :: forall v typ. PersistField typ => EntityField v typ -> [typ] -> Filter v
(<.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
(<=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
(=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Update v
(==.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
(>.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
(>=.) :: forall v typ. PersistField typ => EntityField v typ -> typ -> Filter v
limitOffsetOrder :: PersistEntity val => [SelectOpt val] -> (Int, Int, [SelectOpt val])
listToJSON :: [PersistValue] -> Text
mapToJSON :: [(Text, PersistValue)] -> Text
toJsonText :: ToJSON j => j -> Text
(||.) :: [Filter v] -> [Filter v] -> [Filter v]
entityIdFromJSON :: (PersistEntity record, FromJSON record) => Value -> Parser (Entity record)
entityIdToJSON :: (PersistEntity record, ToJSON record) => Entity record -> Value
entityValues :: PersistEntity record => Entity record -> [PersistValue]
fromPersistValueJSON :: FromJSON a => PersistValue -> Either Text a
keyValueEntityFromJSON :: (PersistEntity record, FromJSON record) => Value -> Parser (Entity record)
keyValueEntityToJSON :: (PersistEntity record, ToJSON record) => Entity record -> Value
tabulateEntity :: PersistEntity record => (forall a. () => EntityField record a -> a) -> Entity record
toPersistValueJSON :: ToJSON a => a -> PersistValue
getPersistMap :: PersistValue -> Either Text [(Text, PersistValue)]
selectKeys :: forall record backend (m :: Type -> Type). (PersistQueryRead backend, MonadResource m, PersistRecordBackend record backend, MonadReader backend m) => [Filter record] -> [SelectOpt record] -> ConduitM () (Key record) m ()
selectKeysList :: forall record backend (m :: Type -> Type). (MonadIO m, PersistQueryRead backend, PersistRecordBackend record backend) => [Filter record] -> [SelectOpt record] -> ReaderT backend m [Key record]
selectList :: forall record backend (m :: Type -> Type). (MonadIO m, PersistQueryRead backend, PersistRecordBackend record backend) => [Filter record] -> [SelectOpt record] -> ReaderT backend m [Entity record]
selectSource :: forall record backend (m :: Type -> Type). (PersistQueryRead backend, MonadResource m, PersistRecordBackend record backend, MonadReader backend m) => [Filter record] -> [SelectOpt record] -> ConduitM () (Entity record) m ()
belongsTo :: forall ent1 ent2 backend (m :: Type -> Type). (PersistStoreRead backend, PersistEntity ent1, PersistRecordBackend ent2 backend, MonadIO m) => (ent1 -> Maybe (Key ent2)) -> ent1 -> ReaderT backend m (Maybe ent2)
belongsToJust :: forall ent1 ent2 backend (m :: Type -> Type). (PersistStoreRead backend, PersistEntity ent1, PersistRecordBackend ent2 backend, MonadIO m) => (ent1 -> Key ent2) -> ent1 -> ReaderT backend m ent2
getEntity :: forall e backend (m :: Type -> Type). (PersistStoreRead backend, PersistRecordBackend e backend, MonadIO m) => Key e -> ReaderT backend m (Maybe (Entity e))
getJust :: forall record backend (m :: Type -> Type). (PersistStoreRead backend, PersistRecordBackend record backend, MonadIO m) => Key record -> ReaderT backend m record
getJustEntity :: forall record backend (m :: Type -> Type). (PersistEntityBackend record ~ BaseBackend backend, MonadIO m, PersistEntity record, PersistStoreRead backend) => Key record -> ReaderT backend m (Entity record)
insertEntity :: forall e backend (m :: Type -> Type). (PersistStoreWrite backend, PersistRecordBackend e backend, SafeToInsert e, MonadIO m, HasCallStack) => e -> ReaderT backend m (Entity e)
insertRecord :: forall record backend (m :: Type -> Type). (PersistEntityBackend record ~ BaseBackend backend, PersistEntity record, MonadIO m, PersistStoreWrite backend, SafeToInsert record, HasCallStack) => record -> ReaderT backend m record
liftPersist :: (MonadIO m, MonadReader backend m) => ReaderT backend IO b -> m b
withBaseBackend :: forall backend (m :: Type -> Type) a. HasPersistBackend backend => ReaderT (BaseBackend backend) m a -> ReaderT backend m a
withCompatibleBackend :: forall sup sub (m :: Type -> Type) a. BackendCompatible sup sub => ReaderT sup m a -> ReaderT sub m a
checkUnique :: forall record backend (m :: Type -> Type). (MonadIO m, PersistRecordBackend record backend, PersistUniqueRead backend) => record -> ReaderT backend m (Maybe (Unique record))
checkUniqueUpdateable :: forall record backend (m :: Type -> Type). (MonadIO m, PersistRecordBackend record backend, PersistUniqueRead backend) => Entity record -> ReaderT backend m (Maybe (Unique record))
getByValue :: forall record (m :: Type -> Type) backend. (MonadIO m, PersistUniqueRead backend, PersistRecordBackend record backend, AtLeastOneUniqueKey record) => record -> ReaderT backend m (Maybe (Entity record))
insertBy :: forall record backend (m :: Type -> Type). (MonadIO m, PersistUniqueWrite backend, PersistRecordBackend record backend, AtLeastOneUniqueKey record, SafeToInsert record) => record -> ReaderT backend m (Either (Entity record) (Key record))
insertUniqueEntity :: forall record backend (m :: Type -> Type). (MonadIO m, PersistRecordBackend record backend, PersistUniqueWrite backend, SafeToInsert record) => record -> ReaderT backend m (Maybe (Entity record))
onlyOneUniqueDef :: (OnlyOneUniqueKey record, Monad proxy) => proxy record -> UniqueDef
onlyUnique :: forall record backend (m :: Type -> Type). (MonadIO m, PersistUniqueWrite backend, PersistRecordBackend record backend, OnlyOneUniqueKey record) => record -> ReaderT backend m (Unique record)
replaceUnique :: forall record backend (m :: Type -> Type). (MonadIO m, Eq (Unique record), PersistRecordBackend record backend, PersistUniqueWrite backend) => Key record -> record -> ReaderT backend m (Maybe (Unique record))
getEntityComments :: EntityDef -> Maybe Text
getEntityDBName :: EntityDef -> EntityNameDB
getEntityExtra :: EntityDef -> Map Text [[Text]]
getEntityFields :: EntityDef -> [FieldDef]
getEntityFieldsDatabase :: EntityDef -> [FieldDef]
getEntityForeignDefs :: EntityDef -> [ForeignDef]
getEntityHaskellName :: EntityDef -> EntityNameHS
getEntityId :: EntityDef -> EntityIdDef
getEntityIdField :: EntityDef -> Maybe FieldDef
getEntityKeyFields :: EntityDef -> NonEmpty FieldDef
getEntitySpan :: EntityDef -> Maybe SourceSpan
getEntityUniques :: EntityDef -> [UniqueDef]
getEntityUniquesNoPrimaryKey :: EntityDef -> [UniqueDef]
isEntitySum :: EntityDef -> Bool
overEntityFields :: ([FieldDef] -> [FieldDef]) -> EntityDef -> EntityDef
setEntityDBName :: EntityNameDB -> EntityDef -> EntityDef
setEntityId :: FieldDef -> EntityDef -> EntityDef
setEntityIdDef :: EntityIdDef -> EntityDef -> EntityDef
addFieldAttr :: FieldAttr -> FieldDef -> FieldDef
isFieldMaybe :: FieldDef -> Bool
isFieldNullable :: FieldDef -> IsNullable
overFieldAttrs :: ([FieldAttr] -> [FieldAttr]) -> FieldDef -> FieldDef
setFieldAttrs :: [FieldAttr] -> FieldDef -> FieldDef
fromPersistValueText :: PersistValue -> Either Text Text
transactionSave :: forall (m :: Type -> Type). MonadIO m => ReaderT SqlBackend m ()
transactionSaveWithIsolation :: forall (m :: Type -> Type). MonadIO m => IsolationLevel -> ReaderT SqlBackend m ()
transactionUndo :: forall (m :: Type -> Type). MonadIO m => ReaderT SqlBackend m ()
transactionUndoWithIsolation :: forall (m :: Type -> Type). MonadIO m => IsolationLevel -> ReaderT SqlBackend m ()
unPrefix :: forall (prefix :: Symbol) record. EntityWithPrefix prefix record -> Entity record
defaultAttribute :: [FieldAttr] -> Maybe Text
emptyBackendSpecificOverrides :: BackendSpecificOverrides
getBackendSpecificForeignKeyName :: BackendSpecificOverrides -> Maybe (EntityNameDB -> FieldNameDB -> ConstraintNameDB)
mkColumns :: [EntityDef] -> EntityDef -> BackendSpecificOverrides -> ([Column], [UniqueDef], [ForeignDef])
setBackendSpecificForeignKeyName :: (EntityNameDB -> FieldNameDB -> ConstraintNameDB) -> BackendSpecificOverrides -> BackendSpecificOverrides
addMigration :: Bool -> Sql -> Migration
addMigrations :: CautiousMigration -> Migration
getMigration :: forall (m :: Type -> Type). (MonadIO m, HasCallStack) => Migration -> ReaderT SqlBackend m [Sql]
migrate :: [EntityDef] -> EntityDef -> Migration
parseMigration :: forall (m :: Type -> Type). (HasCallStack, MonadIO m) => Migration -> ReaderT SqlBackend m (Either [Text] CautiousMigration)
parseMigration' :: forall (m :: Type -> Type). (HasCallStack, MonadIO m) => Migration -> ReaderT SqlBackend m CautiousMigration
printMigration :: forall (m :: Type -> Type). (HasCallStack, MonadIO m) => Migration -> ReaderT SqlBackend m ()
reportError :: Text -> Migration
reportErrors :: [Text] -> Migration
runMigration :: forall (m :: Type -> Type). MonadIO m => Migration -> ReaderT SqlBackend m ()
runMigrationQuiet :: forall (m :: Type -> Type). MonadIO m => Migration -> ReaderT SqlBackend m [Text]
runMigrationSilent :: forall (m :: Type -> Type). MonadUnliftIO m => Migration -> ReaderT SqlBackend m [Text]
runMigrationUnsafe :: forall (m :: Type -> Type). MonadIO m => Migration -> ReaderT SqlBackend m ()
runMigrationUnsafeQuiet :: forall (m :: Type -> Type). (HasCallStack, MonadIO m) => Migration -> ReaderT SqlBackend m [Text]
runSqlCommand :: SqlPersistT IO () -> Migration
showMigration :: forall (m :: Type -> Type). (HasCallStack, MonadIO m) => Migration -> ReaderT SqlBackend m [Text]
decorateSQLWithLimitOffset :: Text -> (Int, Int) -> Text -> Text
deleteWhereCount :: forall val (m :: Type -> Type) backend. (PersistEntity val, MonadIO m, PersistEntityBackend val ~ SqlBackend, BackendCompatible SqlBackend backend) => [Filter val] -> ReaderT backend m Int64
filterClause :: PersistEntity val => Maybe FilterTablePrefix -> SqlBackend -> [Filter val] -> Text
filterClauseWithVals :: PersistEntity val => Maybe FilterTablePrefix -> SqlBackend -> [Filter val] -> (Text, [PersistValue])
orderClause :: PersistEntity val => Maybe FilterTablePrefix -> SqlBackend -> [SelectOpt val] -> Text
updateWhereCount :: forall val (m :: Type -> Type) backend. (PersistEntity val, MonadIO m, SqlBackend ~ PersistEntityBackend val, BackendCompatible SqlBackend backend) => [Filter val] -> [Update val] -> ReaderT backend m Int64
fieldDBName :: PersistEntity record => EntityField record typ -> FieldNameDB
fromSqlKey :: ToBackendKey SqlBackend record => Key record -> Int64
getFieldName :: forall record typ (m :: Type -> Type) backend. (PersistEntity record, PersistEntityBackend record ~ SqlBackend, BackendCompatible SqlBackend backend, Monad m) => EntityField record typ -> ReaderT backend m Text
getTableName :: forall record (m :: Type -> Type) backend. (PersistEntity record, BackendCompatible SqlBackend backend, Monad m) => record -> ReaderT backend m Text
tableDBName :: PersistEntity record => record -> EntityNameDB
toSqlKey :: ToBackendKey SqlBackend record => Int64 -> Key record
withRawQuery :: forall (m :: Type -> Type) a. MonadIO m => Text -> [PersistValue] -> ConduitM [PersistValue] Void IO a -> ReaderT SqlBackend m a
getStmtConn :: SqlBackend -> Text -> IO Statement
rawExecute :: forall (m :: Type -> Type) backend. (MonadIO m, BackendCompatible SqlBackend backend) => Text -> [PersistValue] -> ReaderT backend m ()
rawExecuteCount :: forall (m :: Type -> Type) backend. (MonadIO m, BackendCompatible SqlBackend backend) => Text -> [PersistValue] -> ReaderT backend m Int64
rawQuery :: forall (m :: Type -> Type) env. (MonadResource m, MonadReader env m, BackendCompatible SqlBackend env) => Text -> [PersistValue] -> ConduitM () [PersistValue] m ()
rawQueryRes :: forall (m1 :: Type -> Type) (m2 :: Type -> Type) env. (MonadIO m1, MonadIO m2, BackendCompatible SqlBackend env) => Text -> [PersistValue] -> ReaderT env m1 (Acquire (ConduitM () [PersistValue] m2 ()))
rawSql :: forall a (m :: Type -> Type) backend. (RawSql a, MonadIO m, BackendCompatible SqlBackend backend) => Text -> [PersistValue] -> ReaderT backend m [a]
acquireSqlConn :: (MonadReader backend m, BackendCompatible SqlBackend backend) => m (Acquire backend)
acquireSqlConnWithIsolation :: (MonadReader backend m, BackendCompatible SqlBackend backend) => IsolationLevel -> m (Acquire backend)
close' :: BackendCompatible SqlBackend backend => backend -> IO ()
createSqlPool :: forall backend m. (MonadLoggerIO m, MonadUnliftIO m, BackendCompatible SqlBackend backend) => (LogFunc -> IO backend) -> Int -> m (Pool backend)
createSqlPoolWithConfig :: (MonadLoggerIO m, MonadUnliftIO m, BackendCompatible SqlBackend backend) => (LogFunc -> IO backend) -> ConnectionPoolConfig -> m (Pool backend)
liftSqlPersistMPool :: forall backend m a. (MonadIO m, BackendCompatible SqlBackend backend) => ReaderT backend (NoLoggingT (ResourceT IO)) a -> Pool backend -> m a
runSqlConn :: forall backend m a. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> backend -> m a
runSqlConnWithIsolation :: forall backend m a. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> backend -> IsolationLevel -> m a
runSqlPersistM :: BackendCompatible SqlBackend backend => ReaderT backend (NoLoggingT (ResourceT IO)) a -> backend -> IO a
runSqlPersistMPool :: BackendCompatible SqlBackend backend => ReaderT backend (NoLoggingT (ResourceT IO)) a -> Pool backend -> IO a
runSqlPool :: forall backend m a. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> Pool backend -> m a
runSqlPoolNoTransaction :: forall backend m a. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> Pool backend -> Maybe IsolationLevel -> m a
runSqlPoolWithExtensibleHooks :: forall backend m a. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> Pool backend -> Maybe IsolationLevel -> SqlPoolHooks m backend -> m a
runSqlPoolWithHooks :: forall backend m a before after onException. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> Pool backend -> Maybe IsolationLevel -> (backend -> m before) -> (backend -> m after) -> (backend -> SomeException -> m onException) -> m a
runSqlPoolWithIsolation :: forall backend m a. (MonadUnliftIO m, BackendCompatible SqlBackend backend) => ReaderT backend m a -> Pool backend -> IsolationLevel -> m a
withSqlConn :: forall backend m a. (MonadUnliftIO m, MonadLoggerIO m, BackendCompatible SqlBackend backend) => (LogFunc -> IO backend) -> (backend -> m a) -> m a
withSqlPool :: forall backend m a. (MonadLoggerIO m, MonadUnliftIO m, BackendCompatible SqlBackend backend) => (LogFunc -> IO backend) -> Int -> (Pool backend -> m a) -> m a
withSqlPoolWithConfig :: forall backend m a. (MonadLoggerIO m, MonadUnliftIO m, BackendCompatible SqlBackend backend) => (LogFunc -> IO backend) -> ConnectionPoolConfig -> (Pool backend -> m a) -> m a
defaultConnectionPoolConfig :: ConnectionPoolConfig
readToUnknown :: forall (m :: Type -> Type) a. Monad m => ReaderT SqlReadBackend m a -> ReaderT SqlBackend m a
readToWrite :: forall (m :: Type -> Type) a. Monad m => ReaderT SqlReadBackend m a -> ReaderT SqlWriteBackend m a
writeToUnknown :: forall (m :: Type -> Type) a. Monad m => ReaderT SqlWriteBackend m a -> ReaderT SqlBackend m a
entitiesPrimary :: EntityDef -> NonEmpty FieldDef
entityPrimary :: EntityDef -> Maybe CompositeDef
fieldAttrsContainsNullable :: [FieldAttr] -> IsNullable
isFieldNotGenerated :: FieldDef -> Bool
isHaskellField :: FieldDef -> Bool
keyAndEntityFields :: EntityDef -> NonEmpty FieldDef
keyAndEntityFieldsDatabase :: EntityDef -> NonEmpty FieldDef
noCascade :: FieldCascade
parseFieldAttrs :: [Text] -> [FieldAttr]
renderCascadeAction :: CascadeAction -> Text
renderFieldCascade :: FieldCascade -> Text
type PersistQuery a = PersistQueryWrite a
type PersistStore a = PersistStoreWrite a
type PersistUnique a = PersistUniqueWrite a
class PersistConfig c where {
    type PersistConfigBackend c :: Type -> Type -> Type -> Type;
    type PersistConfigPool c;
}
loadConfig :: PersistConfig c => Value -> Parser c
applyEnv :: PersistConfig c => c -> IO c
createPoolConfig :: PersistConfig c => c -> IO (PersistConfigPool c)
runPool :: (PersistConfig c, MonadUnliftIO m) => c -> PersistConfigBackend c m a -> PersistConfigPool c -> m a
type family PersistConfigBackend c :: Type -> Type -> Type -> Type
type family PersistConfigPool c
type family BackendSpecificFilter backend record
type family BackendSpecificUpdate backend record
data Entity record
Entity :: Key record -> record -> Entity record
[entityKey] :: Entity record -> Key record
[entityVal] :: Entity record -> record
data family EntityField record :: Type -> Type
data Filter record
Filter :: EntityField record typ -> FilterValue typ -> PersistFilter -> Filter record
[filterField] :: Filter record -> EntityField record typ
[filterValue] :: Filter record -> FilterValue typ
[filterFilter] :: Filter record -> PersistFilter
FilterAnd :: [Filter record] -> Filter record
FilterOr :: [Filter record] -> Filter record
BackendFilter :: BackendSpecificFilter (PersistEntityBackend record) record -> Filter record
data FilterValue typ
[FilterValue] :: forall typ. typ -> FilterValue typ
[FilterValues] :: forall typ. [typ] -> FilterValue typ
[UnsafeValue] :: forall a typ. PersistField a => a -> FilterValue typ
data family Key record
class (PersistField Key record, ToJSON Key record, FromJSON Key record, Show Key record, Read Key record, Eq Key record, Ord Key record) => PersistEntity record where {
    type PersistEntityBackend record;
    data Key record;
    data EntityField record :: Type -> Type;
    data Unique record;
}
keyToValues :: PersistEntity record => Key record -> [PersistValue]
keyFromValues :: PersistEntity record => [PersistValue] -> Either Text (Key record)
persistIdField :: PersistEntity record => EntityField record (Key record)
entityDef :: PersistEntity record => proxy record -> EntityDef
persistFieldDef :: PersistEntity record => EntityField record typ -> FieldDef
toPersistFields :: PersistEntity record => record -> [PersistValue]
fromPersistValues :: PersistEntity record => [PersistValue] -> Either Text record
tabulateEntityA :: (PersistEntity record, Applicative f) => (forall a. () => EntityField record a -> f a) -> f (Entity record)
tabulateEntityApply :: (PersistEntity record, Apply f) => (forall a. () => EntityField record a -> f a) -> f (Entity record)
persistUniqueKeys :: PersistEntity record => record -> [Unique record]
persistUniqueToFieldNames :: PersistEntity record => Unique record -> NonEmpty (FieldNameHS, FieldNameDB)
persistUniqueToValues :: PersistEntity record => Unique record -> [PersistValue]
fieldLens :: PersistEntity record => EntityField record field -> forall (f :: Type -> Type). Functor f => (field -> f field) -> Entity record -> f (Entity record)
keyFromRecordM :: PersistEntity record => Maybe (record -> Key record)
type family PersistEntityBackend record
class SafeToInsert a
data SelectOpt record
Asc :: EntityField record typ -> SelectOpt record
Desc :: EntityField record typ -> SelectOpt record
OffsetBy :: Int -> SelectOpt record
LimitTo :: Int -> SelectOpt record
class SymbolToField (sym :: Symbol) rec typ | sym rec -> typ
symbolToField :: SymbolToField sym rec typ => EntityField rec typ
data family Unique record
data Update record
Update :: EntityField record typ -> typ -> PersistUpdate -> Update record
[updateField] :: Update record -> EntityField record typ
[updateValue] :: Update record -> typ
[updateUpdate] :: Update record -> PersistUpdate
BackendUpdate :: BackendSpecificUpdate (PersistEntityBackend record) record -> Update record
newtype OverflowNatural
OverflowNatural :: Natural -> OverflowNatural
[unOverflowNatural] :: OverflowNatural -> Natural
class PersistField a
toPersistValue :: PersistField a => a -> PersistValue
fromPersistValue :: PersistField a => PersistValue -> Either Text a
class (PersistCore backend, PersistStoreRead backend) => PersistQueryRead backend
selectSourceRes :: forall record (m1 :: Type -> Type) (m2 :: Type -> Type). (PersistQueryRead backend, PersistRecordBackend record backend, MonadIO m1, MonadIO m2) => [Filter record] -> [SelectOpt record] -> ReaderT backend m1 (Acquire (ConduitM () (Entity record) m2 ()))
selectFirst :: forall (m :: Type -> Type) record. (PersistQueryRead backend, MonadIO m, PersistRecordBackend record backend) => [Filter record] -> [SelectOpt record] -> ReaderT backend m (Maybe (Entity record))
selectKeysRes :: forall (m1 :: Type -> Type) (m2 :: Type -> Type) record. (PersistQueryRead backend, MonadIO m1, MonadIO m2, PersistRecordBackend record backend) => [Filter record] -> [SelectOpt record] -> ReaderT backend m1 (Acquire (ConduitM () (Key record) m2 ()))
count :: forall (m :: Type -> Type) record. (PersistQueryRead backend, MonadIO m, PersistRecordBackend record backend) => [Filter record] -> ReaderT backend m Int
exists :: forall (m :: Type -> Type) record. (PersistQueryRead backend, MonadIO m, PersistRecordBackend record backend) => [Filter record] -> ReaderT backend m Bool
class (PersistQueryRead backend, PersistStoreWrite backend) => PersistQueryWrite backend
updateWhere :: forall (m :: Type -> Type) record. (PersistQueryWrite backend, MonadIO m, PersistRecordBackend record backend) => [Filter record] -> [Update record] -> ReaderT backend m ()
deleteWhere :: forall (m :: Type -> Type) record. (PersistQueryWrite backend, MonadIO m, PersistRecordBackend record backend) => [Filter record] -> ReaderT backend m ()
class BackendCompatible sup sub
projectBackend :: BackendCompatible sup sub => sub -> sup
data family BackendKey backend
type family BaseBackend backend
class HasPersistBackend backend where {
    type BaseBackend backend;
}
persistBackend :: HasPersistBackend backend => backend -> BaseBackend backend
class HasPersistBackend backend => IsPersistBackend backend
class PersistCore backend where {
    data BackendKey backend;
}
type PersistRecordBackend record backend = (PersistEntity record, PersistEntityBackend record ~ BaseBackend backend)
class (Show BackendKey backend, Read BackendKey backend, Eq BackendKey backend, Ord BackendKey backend, PersistCore backend, PersistField BackendKey backend, ToJSON BackendKey backend, FromJSON BackendKey backend) => PersistStoreRead backend
get :: forall record (m :: Type -> Type). (PersistStoreRead backend, MonadIO m, PersistRecordBackend record backend) => Key record -> ReaderT backend m (Maybe record)
getMany :: forall record (m :: Type -> Type). (PersistStoreRead backend, MonadIO m, PersistRecordBackend record backend) => [Key record] -> ReaderT backend m (Map (Key record) record)
class (Show BackendKey backend, Read BackendKey backend, Eq BackendKey backend, Ord BackendKey backend, PersistStoreRead backend, PersistField BackendKey backend, ToJSON BackendKey backend, FromJSON BackendKey backend) => PersistStoreWrite backend
insert :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend, SafeToInsert record) => record -> ReaderT backend m (Key record)
insert_ :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend, SafeToInsert record) => record -> ReaderT backend m ()
insertMany :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend, SafeToInsert record) => [record] -> ReaderT backend m [Key record]
insertMany_ :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend, SafeToInsert record) => [record] -> ReaderT backend m ()
insertEntityMany :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend) => [Entity record] -> ReaderT backend m ()
insertKey :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend) => Key record -> record -> ReaderT backend m ()
repsert :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend) => Key record -> record -> ReaderT backend m ()
repsertMany :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend) => [(Key record, record)] -> ReaderT backend m ()
replace :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend) => Key record -> record -> ReaderT backend m ()
delete :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend) => Key record -> ReaderT backend m ()
update :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend) => Key record -> [Update record] -> ReaderT backend m ()
updateGet :: forall record (m :: Type -> Type). (PersistStoreWrite backend, MonadIO m, PersistRecordBackend record backend) => Key record -> [Update record] -> ReaderT backend m record
class (PersistEntity record, PersistEntityBackend record ~ backend, PersistCore backend) => ToBackendKey backend record
toBackendKey :: ToBackendKey backend record => Key record -> BackendKey backend
fromBackendKey :: ToBackendKey backend record => BackendKey backend -> Key record
class PersistEntity record => AtLeastOneUniqueKey record
requireUniquesP :: AtLeastOneUniqueKey record => record -> NonEmpty (Unique record)
type MultipleUniqueKeysError ty = 'Text "The entity " ':<>: 'ShowType ty ':<>: 'Text " has multiple unique keys." ':$$: 'Text "The function you are trying to call requires only a single " ':<>: 'Text "unique key." ':$$: 'Text "There is probably a variant of the function with 'By' " ':<>: 'Text "appended that will allow you to select a unique key " ':<>: 'Text "for the operation."
type NoUniqueKeysError ty = 'Text "The entity " ':<>: 'ShowType ty ':<>: 'Text " does not have any unique keys." ':$$: 'Text "The function you are trying to call requires a unique key " ':<>: 'Text "to be defined on the entity."
class PersistEntity record => OnlyOneUniqueKey record
onlyUniqueP :: OnlyOneUniqueKey record => record -> Unique record
class PersistStoreRead backend => PersistUniqueRead backend
getBy :: forall record (m :: Type -> Type). (PersistUniqueRead backend, MonadIO m, PersistRecordBackend record backend) => Unique record -> ReaderT backend m (Maybe (Entity record))
existsBy :: forall record (m :: Type -> Type). (PersistUniqueRead backend, MonadIO m, PersistRecordBackend record backend) => Unique record -> ReaderT backend m Bool
class (PersistUniqueRead backend, PersistStoreWrite backend) => PersistUniqueWrite backend
deleteBy :: forall record (m :: Type -> Type). (PersistUniqueWrite backend, MonadIO m, PersistRecordBackend record backend) => Unique record -> ReaderT backend m ()
insertUnique :: forall record (m :: Type -> Type). (PersistUniqueWrite backend, MonadIO m, PersistRecordBackend record backend, SafeToInsert record) => record -> ReaderT backend m (Maybe (Key record))
insertUnique_ :: forall record (m :: Type -> Type). (PersistUniqueWrite backend, MonadIO m, PersistRecordBackend record backend, SafeToInsert record) => record -> ReaderT backend m (Maybe ())
upsert :: forall record (m :: Type -> Type). (PersistUniqueWrite backend, MonadIO m, PersistRecordBackend record backend, OnlyOneUniqueKey record, SafeToInsert record) => record -> [Update record] -> ReaderT backend m (Entity record)
upsertBy :: forall record (m :: Type -> Type). (PersistUniqueWrite backend, MonadIO m, PersistRecordBackend record backend, SafeToInsert record) => Unique record -> record -> [Update record] -> ReaderT backend m (Entity record)
putMany :: forall record (m :: Type -> Type). (PersistUniqueWrite backend, MonadIO m, PersistRecordBackend record backend, SafeToInsert record) => [record] -> ReaderT backend m ()
newtype ConstraintNameDB
ConstraintNameDB :: Text -> ConstraintNameDB
[unConstraintNameDB] :: ConstraintNameDB -> Text
newtype ConstraintNameHS
ConstraintNameHS :: Text -> ConstraintNameHS
[unConstraintNameHS] :: ConstraintNameHS -> Text
class DatabaseName a
escapeWith :: DatabaseName a => (Text -> str) -> a -> str
newtype EntityNameDB
EntityNameDB :: Text -> EntityNameDB
[unEntityNameDB] :: EntityNameDB -> Text
newtype EntityNameHS
EntityNameHS :: Text -> EntityNameHS
[unEntityNameHS] :: EntityNameHS -> Text
newtype FieldNameDB
FieldNameDB :: Text -> FieldNameDB
[unFieldNameDB] :: FieldNameDB -> Text
newtype FieldNameHS
FieldNameHS :: Text -> FieldNameHS
[unFieldNameHS] :: FieldNameHS -> Text
data LiteralType
Escaped :: LiteralType
Unescaped :: LiteralType
DbSpecific :: LiteralType
data PersistValue
PersistText :: Text -> PersistValue
PersistByteString :: ByteString -> PersistValue
PersistInt64 :: Int64 -> PersistValue
PersistDouble :: Double -> PersistValue
PersistRational :: Rational -> PersistValue
PersistBool :: Bool -> PersistValue
PersistDay :: Day -> PersistValue
PersistTimeOfDay :: TimeOfDay -> PersistValue
PersistUTCTime :: UTCTime -> PersistValue
PersistNull :: PersistValue
PersistList :: [PersistValue] -> PersistValue
PersistMap :: [(Text, PersistValue)] -> PersistValue
PersistObjectId :: ByteString -> PersistValue
PersistArray :: [PersistValue] -> PersistValue
PersistLiteral_ :: LiteralType -> ByteString -> PersistValue
pattern PersistDbSpecific :: ByteString -> PersistValue
pattern PersistLiteral :: ByteString -> PersistValue
pattern PersistLiteralEscaped :: ByteString -> PersistValue
newtype EntityWithPrefix (prefix :: Symbol) record
EntityWithPrefix :: Entity record -> EntityWithPrefix (prefix :: Symbol) record
[unEntityWithPrefix] :: EntityWithPrefix (prefix :: Symbol) record -> Entity record
class PersistField a => PersistFieldSql a
sqlType :: PersistFieldSql a => Proxy a -> SqlType
class RawSql a
rawSqlCols :: RawSql a => (Text -> Text) -> a -> (Int, [Text])
rawSqlColCountReason :: RawSql a => a -> String
rawSqlProcessRow :: RawSql a => [PersistValue] -> Either Text a
data BackendSpecificOverrides
type CautiousMigration = [(Bool, Sql)]
type Migration = WriterT [Text] WriterT CautiousMigration ReaderT SqlBackend IO ()
newtype PersistUnsafeMigrationException
PersistUnsafeMigrationException :: [(Bool, Sql)] -> PersistUnsafeMigrationException
type Sql = Text
data FilterTablePrefix
PrefixTableName :: FilterTablePrefix
PrefixExcluded :: FilterTablePrefix
data Column
Column :: !FieldNameDB -> !Bool -> !SqlType -> !Maybe Text -> !Maybe Text -> !Maybe ConstraintNameDB -> !Maybe Integer -> !Maybe ColumnReference -> Column
[cName] :: Column -> !FieldNameDB
[cNull] :: Column -> !Bool
[cSqlType] :: Column -> !SqlType
[cDefault] :: Column -> !Maybe Text
[cGenerated] :: Column -> !Maybe Text
[cDefaultConstraintName] :: Column -> !Maybe ConstraintNameDB
[cMaxLen] :: Column -> !Maybe Integer
[cReference] :: Column -> !Maybe ColumnReference
data ColumnReference
ColumnReference :: !EntityNameDB -> !ConstraintNameDB -> !FieldCascade -> ColumnReference
[crTableName] :: ColumnReference -> !EntityNameDB
[crConstraintName] :: ColumnReference -> !ConstraintNameDB
[crFieldCascade] :: ColumnReference -> !FieldCascade
type ConnectionPool = Pool SqlBackend
data ConnectionPoolConfig
ConnectionPoolConfig :: Int -> NominalDiffTime -> Int -> ConnectionPoolConfig
[connectionPoolConfigStripes] :: ConnectionPoolConfig -> Int
[connectionPoolConfigIdleTimeout] :: ConnectionPoolConfig -> NominalDiffTime
[connectionPoolConfigSize] :: ConnectionPoolConfig -> Int
data PersistentSqlException
StatementAlreadyFinalized :: Text -> PersistentSqlException
Couldn'tGetSQLConnection :: PersistentSqlException
newtype Single a
Single :: a -> Single a
[unSingle] :: Single a -> a
type SqlPersistM = SqlPersistT NoLoggingT ResourceT IO
type SqlPersistT = ReaderT SqlBackend
type IsSqlBackend backend = (IsPersistBackend backend, BaseBackend backend ~ SqlBackend)
type SqlBackendCanRead backend = (BackendCompatible SqlBackend backend, PersistQueryRead backend, PersistStoreRead backend, PersistUniqueRead backend)
type SqlBackendCanWrite backend = (SqlBackendCanRead backend, PersistQueryWrite backend, PersistStoreWrite backend, PersistUniqueWrite backend)
newtype SqlReadBackend
SqlReadBackend :: SqlBackend -> SqlReadBackend
[unSqlReadBackend] :: SqlReadBackend -> SqlBackend
type SqlReadT (m :: Type -> Type) a = forall backend. SqlBackendCanRead backend => ReaderT backend m a
newtype SqlWriteBackend
SqlWriteBackend :: SqlBackend -> SqlWriteBackend
[unSqlWriteBackend] :: SqlWriteBackend -> SqlBackend
type SqlWriteT (m :: Type -> Type) a = forall backend. SqlBackendCanWrite backend => ReaderT backend m a
data SqlBackend
data InsertSqlResult
ISRSingle :: Text -> InsertSqlResult
ISRInsertGet :: Text -> Text -> InsertSqlResult
ISRManyKeys :: Text -> [PersistValue] -> InsertSqlResult
data IsolationLevel
ReadUncommitted :: IsolationLevel
ReadCommitted :: IsolationLevel
RepeatableRead :: IsolationLevel
Serializable :: IsolationLevel
type LogFunc = Loc -> LogSource -> LogLevel -> LogStr -> IO ()
data Statement
Statement :: IO () -> IO () -> ([PersistValue] -> IO Int64) -> (forall (m :: Type -> Type). MonadIO m => [PersistValue] -> Acquire (ConduitM () [PersistValue] m ())) -> Statement
[stmtFinalize] :: Statement -> IO ()
[stmtReset] :: Statement -> IO ()
[stmtExecute] :: Statement -> [PersistValue] -> IO Int64
[stmtQuery] :: Statement -> forall (m :: Type -> Type). MonadIO m => [PersistValue] -> Acquire (ConduitM () [PersistValue] m ())
type Attr = Text
data CascadeAction
Cascade :: CascadeAction
Restrict :: CascadeAction
SetNull :: CascadeAction
SetDefault :: CascadeAction
data Checkmark
Active :: Checkmark
Inactive :: Checkmark
data CompositeDef
CompositeDef :: !NonEmpty FieldDef -> ![Attr] -> CompositeDef
[compositeFields] :: CompositeDef -> !NonEmpty FieldDef
[compositeAttrs] :: CompositeDef -> ![Attr]
data EmbedEntityDef
EmbedEntityDef :: EntityNameHS -> [EmbedFieldDef] -> EmbedEntityDef
[embeddedHaskell] :: EmbedEntityDef -> EntityNameHS
[embeddedFields] :: EmbedEntityDef -> [EmbedFieldDef]
data EmbedFieldDef
EmbedFieldDef :: FieldNameDB -> Maybe (Either SelfEmbed EntityNameHS) -> EmbedFieldDef
[emFieldDB] :: EmbedFieldDef -> FieldNameDB
[emFieldEmbed] :: EmbedFieldDef -> Maybe (Either SelfEmbed EntityNameHS)
data EntityDef
data EntityIdDef
EntityIdField :: !FieldDef -> EntityIdDef
EntityIdNaturalKey :: !CompositeDef -> EntityIdDef
type ExtraLine = [Text]
data FieldAttr
FieldAttrMaybe :: FieldAttr
FieldAttrNullable :: FieldAttr
FieldAttrMigrationOnly :: FieldAttr
FieldAttrSafeToRemove :: FieldAttr
FieldAttrNoreference :: FieldAttr
FieldAttrReference :: Text -> FieldAttr
FieldAttrConstraint :: Text -> FieldAttr
FieldAttrDefault :: Text -> FieldAttr
FieldAttrSqltype :: Text -> FieldAttr
FieldAttrMaxlen :: Integer -> FieldAttr
FieldAttrSql :: Text -> FieldAttr
FieldAttrOther :: Text -> FieldAttr
data FieldCascade
FieldCascade :: !Maybe CascadeAction -> !Maybe CascadeAction -> FieldCascade
[fcOnUpdate] :: FieldCascade -> !Maybe CascadeAction
[fcOnDelete] :: FieldCascade -> !Maybe CascadeAction
data FieldDef
FieldDef :: !FieldNameHS -> !FieldNameDB -> !FieldType -> !SqlType -> ![FieldAttr] -> !Bool -> !ReferenceDef -> !FieldCascade -> !Maybe Text -> !Maybe Text -> !Bool -> FieldDef
[fieldHaskell] :: FieldDef -> !FieldNameHS
[fieldDB] :: FieldDef -> !FieldNameDB
[fieldType] :: FieldDef -> !FieldType
[fieldSqlType] :: FieldDef -> !SqlType
[fieldAttrs] :: FieldDef -> ![FieldAttr]
[fieldStrict] :: FieldDef -> !Bool
[fieldReference] :: FieldDef -> !ReferenceDef
[fieldCascade] :: FieldDef -> !FieldCascade
[fieldComments] :: FieldDef -> !Maybe Text
[fieldGenerated] :: FieldDef -> !Maybe Text
[fieldIsImplicitIdColumn] :: FieldDef -> !Bool
data FieldType
FTTypeCon :: Maybe Text -> Text -> FieldType
FTLit :: FieldTypeLit -> FieldType
FTTypePromoted :: Text -> FieldType
FTApp :: FieldType -> FieldType -> FieldType
FTList :: FieldType -> FieldType
data ForeignDef
ForeignDef :: !EntityNameHS -> !EntityNameDB -> !ConstraintNameHS -> !ConstraintNameDB -> !FieldCascade -> ![(ForeignFieldDef, ForeignFieldDef)] -> ![Attr] -> Bool -> Bool -> ForeignDef
[foreignRefTableHaskell] :: ForeignDef -> !EntityNameHS
[foreignRefTableDBName] :: ForeignDef -> !EntityNameDB
[foreignConstraintNameHaskell] :: ForeignDef -> !ConstraintNameHS
[foreignConstraintNameDBName] :: ForeignDef -> !ConstraintNameDB
[foreignFieldCascade] :: ForeignDef -> !FieldCascade
[foreignFields] :: ForeignDef -> ![(ForeignFieldDef, ForeignFieldDef)]
[foreignAttrs] :: ForeignDef -> ![Attr]
[foreignNullable] :: ForeignDef -> Bool
[foreignToPrimary] :: ForeignDef -> Bool
type ForeignFieldDef = (FieldNameHS, FieldNameDB)
data IsNullable
Nullable :: !WhyNullable -> IsNullable
NotNullable :: IsNullable
data PersistException
PersistError :: Text -> PersistException
PersistMarshalError :: Text -> PersistException
PersistInvalidField :: Text -> PersistException
PersistForeignConstraintUnmet :: Text -> PersistException
PersistMongoDBError :: Text -> PersistException
PersistMongoDBUnsupported :: Text -> PersistException
data PersistFilter
Eq :: PersistFilter
Ne :: PersistFilter
Gt :: PersistFilter
Lt :: PersistFilter
Ge :: PersistFilter
Le :: PersistFilter
In :: PersistFilter
NotIn :: PersistFilter
BackendSpecificFilter :: Text -> PersistFilter
data PersistUpdate
Assign :: PersistUpdate
Add :: PersistUpdate
Subtract :: PersistUpdate
Multiply :: PersistUpdate
Divide :: PersistUpdate
BackendSpecificUpdate :: Text -> PersistUpdate
data ReferenceDef
NoReference :: ReferenceDef
ForeignRef :: !EntityNameHS -> ReferenceDef
EmbedRef :: EntityNameHS -> ReferenceDef
SelfReference :: ReferenceDef
data SqlType
SqlString :: SqlType
SqlInt32 :: SqlType
SqlInt64 :: SqlType
SqlReal :: SqlType
SqlNumeric :: Word32 -> Word32 -> SqlType
SqlBool :: SqlType
SqlDay :: SqlType
SqlTime :: SqlType
SqlDayTime :: SqlType
SqlBlob :: SqlType
SqlOther :: Text -> SqlType
data UniqueDef
UniqueDef :: !ConstraintNameHS -> !ConstraintNameDB -> !NonEmpty (FieldNameHS, FieldNameDB) -> ![Attr] -> UniqueDef
[uniqueHaskell] :: UniqueDef -> !ConstraintNameHS
[uniqueDBName] :: UniqueDef -> !ConstraintNameDB
[uniqueFields] :: UniqueDef -> !NonEmpty (FieldNameHS, FieldNameDB)
[uniqueAttrs] :: UniqueDef -> ![Attr]
data UpdateException
KeyNotFound :: String -> UpdateException
UpsertError :: String -> UpdateException
data WhyNullable
ByMaybeAttr :: WhyNullable
ByNullableAttr :: WhyNullable

-- | Information required to setup a connection pool.
data SqliteConf
SqliteConf :: Text -> Int -> SqliteConf
[sqlDatabase] :: SqliteConf -> Text
[sqlPoolSize] :: SqliteConf -> Int
SqliteConfInfo :: SqliteConnectionInfo -> Int -> SqliteConf
[sqlConnInfo] :: SqliteConf -> SqliteConnectionInfo
[sqlPoolSize] :: SqliteConf -> Int

-- | Information required to connect to a sqlite database. We export lenses
--   instead of fields to avoid being limited to the current
--   implementation.
data SqliteConnectionInfo

-- | Creates a SqliteConnectionInfo from a connection string, with the
--   default settings.
mkSqliteConnectionInfo :: Text -> SqliteConnectionInfo
sqlConnectionStr :: Lens' SqliteConnectionInfo Text
walEnabled :: Lens' SqliteConnectionInfo Bool
fkEnabled :: Lens' SqliteConnectionInfo Bool
extraPragmas :: Lens' SqliteConnectionInfo [Text]

-- | A convenience helper which creates a new database connection and runs
--   the given block, handling <tt>MonadResource</tt> and
--   <tt>MonadLogger</tt> requirements. Note that all log messages are
--   discarded.
runSqlite :: MonadUnliftIO m => Text -> ReaderT SqlBackend (NoLoggingT (ResourceT m)) a -> m a

-- | A convenience helper which creates a new database connection and runs
--   the given block, handling <tt>MonadResource</tt> and
--   <tt>MonadLogger</tt> requirements. Note that all log messages are
--   discarded.
runSqliteInfo :: MonadUnliftIO m => SqliteConnectionInfo -> ReaderT SqlBackend (NoLoggingT (ResourceT m)) a -> m a

-- | Wrap up a raw <a>Connection</a> as a Persistent SQL <a>Connection</a>.
--   
--   <h3><b>Example usage</b></h3>
--   
--   <pre>
--   {-# LANGUAGE GADTs #-}
--   {-# LANGUAGE ScopedTypeVariables #-}
--   {-# LANGUAGE OverloadedStrings #-}
--   {-# LANGUAGE MultiParamTypeClasses #-}
--   {-# LANGUAGE TypeFamilies #-}
--   {-# LANGUAGE TemplateHaskell #-}
--   {-# LANGUAGE QuasiQuotes #-}
--   {-# LANGUAGE GeneralizedNewtypeDeriving #-}
--   
--   import Control.Monad.IO.Class  (liftIO)
--   import Database.Persist
--   import Database.Sqlite
--   import Database.Persist.Sqlite
--   import Database.Persist.TH
--   
--   share [mkPersist sqlSettings, mkMigrate "migrateAll"] [persistLowerCase|
--   Person
--     name String
--     age Int Maybe
--     deriving Show
--   |]
--   
--   main :: IO ()
--   main = do
--     conn &lt;- open "/home/sibi/test.db"
--     (backend :: SqlBackend) &lt;- wrapConnection conn (\_ _ _ _ -&gt; return ())
--     flip runSqlPersistM backend $ do
--            runMigration migrateAll
--            insert_ $ Person "John doe" $ Just 35
--            insert_ $ Person "Hema" $ Just 36
--            (pers :: [Entity Person]) &lt;- selectList [] []
--            liftIO $ print pers
--     close' backend
--   </pre>
--   
--   On executing it, you get this output:
--   
--   <pre>
--   Migrating: CREATE TABLE "person"("id" INTEGER PRIMARY KEY,"name" VARCHAR NOT NULL,"age" INTEGER NULL)
--   [Entity {entityKey = PersonKey {unPersonKey = SqlBackendKey {unSqlBackendKey = 1}}, entityVal = Person {personName = "John doe", personAge = Just 35}},Entity {entityKey = PersonKey {unPersonKey = SqlBackendKey {unSqlBackendKey = 2}}, entityVal = Person {personName = "Hema", personAge = Just 36}}]
--   </pre>
wrapConnection :: Connection -> LogFunc -> IO SqlBackend

-- | Wrap up a raw <a>Connection</a> as a Persistent SQL <a>Connection</a>,
--   allowing full control over WAL and FK constraints.
wrapConnectionInfo :: SqliteConnectionInfo -> Connection -> LogFunc -> IO SqlBackend

-- | Mock a migration even when the database is not present. This function
--   performs the same functionality of <a>printMigration</a> with the
--   difference that an actual database isn't needed for it.
mockMigration :: Migration -> IO ()

-- | Retry if a Busy is thrown, following an exponential backoff strategy.
retryOnBusy :: (MonadUnliftIO m, MonadLoggerIO m) => m a -> m a

-- | Wait until some noop action on the database does not return an
--   <a>ErrorBusy</a>. See <a>retryOnBusy</a>.
waitForDatabase :: forall (m :: Type -> Type) backend. (MonadUnliftIO m, MonadLoggerIO m, BackendCompatible SqlBackend backend) => ReaderT backend m ()

-- | Data type for reporting foreign key violations using
--   <a>checkForeignKeys</a>.
data ForeignKeyViolation
ForeignKeyViolation :: Text -> Text -> Int64 -> ForeignKeyViolation

-- | The table of the violated constraint
[foreignKeyTable] :: ForeignKeyViolation -> Text

-- | The column of the violated constraint
[foreignKeyColumn] :: ForeignKeyViolation -> Text

-- | The ROWID of the row with the violated foreign key constraint
[foreignKeyRowId] :: ForeignKeyViolation -> Int64

-- | Outputs all (if any) the violated foreign key constraints in the
--   database.
--   
--   The main use is to validate that no foreign key constraints were
--   broken/corrupted by anyone operating on the database with foreign keys
--   disabled. See <tt>fkEnabled</tt>.
checkForeignKeys :: forall (m :: Type -> Type) env. (MonadResource m, MonadReader env m, BackendCompatible SqlBackend env) => ConduitM () ForeignKeyViolation m ()

-- | Wrapper for persistent SqlBackends that carry the corresponding
--   <a>Connection</a>.
data RawSqlite backend

-- | Open a <tt><a>RawSqlite</a> <a>SqlBackend</a></tt> connection from a
--   <a>SqliteConnectionInfo</a>.
--   
--   When using this function, the caller has to accept the responsibility
--   of cleaning up the resulting connection. To do this, use
--   <tt>close</tt> with the <tt>rawSqliteConnection</tt> - it's enough to
--   simply drop the <a>persistBackend</a> afterwards.
openRawSqliteConn :: (MonadUnliftIO m, MonadLoggerIO m) => SqliteConnectionInfo -> m (RawSqlite SqlBackend)
persistentBackend :: forall backend1 backend2 f. Functor f => (backend1 -> f backend2) -> RawSqlite backend1 -> f (RawSqlite backend2)
rawSqliteConnection :: forall backend f. Functor f => (Connection -> f Connection) -> RawSqlite backend -> f (RawSqlite backend)

-- | Like <a>withSqliteConnInfo</a>, but exposes the internal
--   <a>Connection</a>. For power users who want to manually interact with
--   SQLite's C API via internals exposed by
--   <a>Database.Sqlite.Internal</a>
withRawSqliteConnInfo :: (MonadUnliftIO m, MonadLoggerIO m) => SqliteConnectionInfo -> (RawSqlite SqlBackend -> m a) -> m a

-- | Like <a>createSqlitePoolFromInfo</a>, but like
--   <a>withRawSqliteConnInfo</a> it exposes the internal
--   <a>Connection</a>.
--   
--   For power users who want to manually interact with SQLite's C API via
--   internals exposed by <a>Database.Sqlite.Internal</a>. The callback can
--   be used to run arbitrary actions on the connection upon allocation
--   from the pool.
createRawSqlitePoolFromInfo :: (MonadLoggerIO m, MonadUnliftIO m) => SqliteConnectionInfo -> (RawSqlite SqlBackend -> m ()) -> Int -> m (Pool (RawSqlite SqlBackend))

-- | Like <a>createRawSqlitePoolFromInfo</a>, but doesn't require a
--   callback operating on the connection.
createRawSqlitePoolFromInfo_ :: (MonadLoggerIO m, MonadUnliftIO m) => SqliteConnectionInfo -> Int -> m (Pool (RawSqlite SqlBackend))

-- | Like <tt>createSqlitePoolInfo</tt>, but based on
--   <a>createRawSqlitePoolFromInfo</a>.
withRawSqlitePoolInfo :: (MonadUnliftIO m, MonadLoggerIO m) => SqliteConnectionInfo -> (RawSqlite SqlBackend -> m ()) -> Int -> (Pool (RawSqlite SqlBackend) -> m a) -> m a

-- | Like <tt>createSqlitePoolInfo</tt>, but based on
--   <a>createRawSqlitePoolFromInfo_</a>.
withRawSqlitePoolInfo_ :: (MonadUnliftIO m, MonadLoggerIO m) => SqliteConnectionInfo -> Int -> (Pool (RawSqlite SqlBackend) -> m a) -> m a
instance Database.Persist.Class.PersistStore.BackendCompatible b (Database.Persist.Sqlite.RawSqlite b)
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), GHC.Internal.Enum.Bounded (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Internal.Enum.Bounded (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), GHC.Internal.Enum.Enum (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Internal.Enum.Enum (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), GHC.Classes.Eq (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Classes.Eq (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance GHC.Classes.Eq Database.Persist.Sqlite.ForeignKeyViolation
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistStore.BackendKey b)) => Data.Aeson.Types.FromJSON.FromJSON (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance Data.Aeson.Types.FromJSON.FromJSON Database.Persist.Sqlite.SqliteConf
instance Data.Aeson.Types.FromJSON.FromJSON Database.Persist.Sqlite.SqliteConnectionInfo
instance Database.Persist.Class.PersistStore.HasPersistBackend b => Database.Persist.Class.PersistStore.HasPersistBackend (Database.Persist.Sqlite.RawSqlite b)
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), GHC.Internal.Real.Integral (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Internal.Real.Integral (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), GHC.Internal.Num.Num (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Internal.Num.Num (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), GHC.Classes.Ord (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Classes.Ord (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance GHC.Classes.Ord Database.Persist.Sqlite.ForeignKeyViolation
instance Database.Persist.Class.PersistConfig.PersistConfig Database.Persist.Sqlite.SqliteConf
instance Database.Persist.Class.PersistStore.PersistCore b => Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b)
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistStore.BackendKey b)) => Database.Persist.Class.PersistField.PersistField (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistStore.BackendKey b)) => Database.Persist.Sql.Class.PersistFieldSql (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistQuery.PersistQueryRead b) => Database.Persist.Class.PersistQuery.PersistQueryRead (Database.Persist.Sqlite.RawSqlite b)
instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistQuery.PersistQueryWrite b) => Database.Persist.Class.PersistQuery.PersistQueryWrite (Database.Persist.Sqlite.RawSqlite b)
instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistStore.PersistStoreRead b) => Database.Persist.Class.PersistStore.PersistStoreRead (Database.Persist.Sqlite.RawSqlite b)
instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistStore.PersistStoreWrite b) => Database.Persist.Class.PersistStore.PersistStoreWrite (Database.Persist.Sqlite.RawSqlite b)
instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistUnique.PersistUniqueRead b) => Database.Persist.Class.PersistUnique.PersistUniqueRead (Database.Persist.Sqlite.RawSqlite b)
instance (Database.Persist.Class.PersistStore.HasPersistBackend b, Database.Persist.Class.PersistUnique.PersistUniqueWrite b) => Database.Persist.Class.PersistUnique.PersistUniqueWrite (Database.Persist.Sqlite.RawSqlite b)
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), GHC.Internal.Read.Read (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Internal.Read.Read (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), GHC.Internal.Real.Real (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Internal.Real.Real (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), GHC.Internal.Show.Show (Database.Persist.Class.PersistStore.BackendKey b)) => GHC.Internal.Show.Show (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
instance GHC.Internal.Show.Show Database.Persist.Sqlite.ForeignKeyViolation
instance GHC.Internal.Show.Show Database.Persist.Sqlite.SqliteConf
instance GHC.Internal.Show.Show Database.Persist.Sqlite.SqliteConnectionInfo
instance (Database.Persist.Class.PersistStore.PersistCore b, Database.Persist.Class.PersistStore.PersistCore (Database.Persist.Sqlite.RawSqlite b), Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistStore.BackendKey b)) => Data.Aeson.Types.ToJSON.ToJSON (Database.Persist.Class.PersistStore.BackendKey (Database.Persist.Sqlite.RawSqlite b))
