-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Monad transformer for the persistent API -- -- A monad transformer and mtl-style type class for using the persistent -- API directly in your monad transformer stack. @package persistent-mtl @version 0.2.2.0 -- | Defines the MonadRerunnableIO type class that is functionally -- equivalent to MonadIO, but use of it requires the user to -- explicitly acknowledge that the given IO operation can be rerun. module Control.Monad.IO.Rerunnable -- | A copy of MonadIO to explicitly allow only IO operations that -- are rerunnable, e.g. in the context of a SQL transaction. class Monad m => MonadRerunnableIO m -- | Lift the given IO operation to m. -- -- The given IO operation may be rerun, so use of this function requires -- manually verifying that the given IO operation is rerunnable. rerunnableIO :: MonadRerunnableIO m => IO a -> m a instance Control.Monad.IO.Rerunnable.MonadRerunnableIO GHC.Types.IO instance Control.Monad.IO.Rerunnable.MonadRerunnableIO m => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.Reader.ReaderT r m) instance Control.Monad.IO.Rerunnable.MonadRerunnableIO m => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.Except.ExceptT e m) instance Control.Monad.IO.Rerunnable.MonadRerunnableIO m => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.Identity.IdentityT m) instance Control.Monad.IO.Rerunnable.MonadRerunnableIO m => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.Maybe.MaybeT m) instance (GHC.Base.Monoid w, Control.Monad.IO.Rerunnable.MonadRerunnableIO m) => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance (GHC.Base.Monoid w, Control.Monad.IO.Rerunnable.MonadRerunnableIO m) => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.RWS.Strict.RWST r w s m) instance Control.Monad.IO.Rerunnable.MonadRerunnableIO m => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.State.Lazy.StateT s m) instance Control.Monad.IO.Rerunnable.MonadRerunnableIO m => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.State.Strict.StateT s m) instance (GHC.Base.Monoid w, Control.Monad.IO.Rerunnable.MonadRerunnableIO m) => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance (GHC.Base.Monoid w, Control.Monad.IO.Rerunnable.MonadRerunnableIO m) => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.Writer.Strict.WriterT w m) instance Control.Monad.IO.Rerunnable.MonadRerunnableIO m => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Control.Monad.Trans.Resource.Internal.ResourceT m) -- | Defines the SqlQueryRep data type that contains a constructor -- corresponding to a persistent function. -- -- This file is autogenerated, to keep it in sync with -- Database.Persist.Monad.Shim. module Database.Persist.Monad.SqlQueryRep -- | The data type containing a constructor for each persistent function -- we'd like to lift into MonadSqlQuery. -- -- The record type parameter contains the PersistEntity -- types used in a given function. -- -- We're using a free-monads-like technique here to allow us to -- introspect persistent functions in MonadSqlQuery, e.g. to mock -- out persistent calls in tests. data SqlQueryRep record a -- | Constructor corresponding to get [Get] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record (Maybe record) -- | Constructor corresponding to getMany [GetMany] :: PersistRecordBackend record SqlBackend => [Key record] -> SqlQueryRep record (Map (Key record) record) -- | Constructor corresponding to getJust [GetJust] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record record -- | Constructor corresponding to getJustEntity [GetJustEntity] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record (Entity record) -- | Constructor corresponding to getEntity [GetEntity] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to belongsTo [BelongsTo] :: (PersistEntity record1, PersistRecordBackend record2 SqlBackend) => (record1 -> Maybe (Key record2)) -> record1 -> SqlQueryRep (record1, record2) (Maybe record2) -- | Constructor corresponding to belongsToJust [BelongsToJust] :: (PersistEntity record1, PersistRecordBackend record2 SqlBackend) => (record1 -> Key record2) -> record1 -> SqlQueryRep (record1, record2) record2 -- | Constructor corresponding to insert [Insert] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Key record) -- | Constructor corresponding to insert_ [Insert_] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record () -- | Constructor corresponding to insertMany [InsertMany] :: PersistRecordBackend record SqlBackend => [record] -> SqlQueryRep record [Key record] -- | Constructor corresponding to insertMany_ [InsertMany_] :: PersistRecordBackend record SqlBackend => [record] -> SqlQueryRep record () -- | Constructor corresponding to insertEntityMany [InsertEntityMany] :: PersistRecordBackend record SqlBackend => [Entity record] -> SqlQueryRep record () -- | Constructor corresponding to insertKey [InsertKey] :: PersistRecordBackend record SqlBackend => Key record -> record -> SqlQueryRep record () -- | Constructor corresponding to repsert [Repsert] :: PersistRecordBackend record SqlBackend => Key record -> record -> SqlQueryRep record () -- | Constructor corresponding to repsertMany [RepsertMany] :: PersistRecordBackend record SqlBackend => [(Key record, record)] -> SqlQueryRep record () -- | Constructor corresponding to replace [Replace] :: PersistRecordBackend record SqlBackend => Key record -> record -> SqlQueryRep record () -- | Constructor corresponding to delete [Delete] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record () -- | Constructor corresponding to update [Update] :: PersistRecordBackend record SqlBackend => Key record -> [Update record] -> SqlQueryRep record () -- | Constructor corresponding to updateGet [UpdateGet] :: PersistRecordBackend record SqlBackend => Key record -> [Update record] -> SqlQueryRep record record -- | Constructor corresponding to insertEntity [InsertEntity] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Entity record) -- | Constructor corresponding to insertRecord [InsertRecord] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record record -- | Constructor corresponding to getBy [GetBy] :: PersistRecordBackend record SqlBackend => Unique record -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to getByValue [GetByValue] :: (PersistRecordBackend record SqlBackend, AtLeastOneUniqueKey record) => record -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to checkUnique [CheckUnique] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Maybe (Unique record)) -- | Constructor corresponding to checkUniqueUpdateable [CheckUniqueUpdateable] :: PersistRecordBackend record SqlBackend => Entity record -> SqlQueryRep record (Maybe (Unique record)) -- | Constructor corresponding to deleteBy [DeleteBy] :: PersistRecordBackend record SqlBackend => Unique record -> SqlQueryRep record () -- | Constructor corresponding to insertUnique [InsertUnique] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Maybe (Key record)) -- | Constructor corresponding to upsert [Upsert] :: (PersistRecordBackend record SqlBackend, OnlyOneUniqueKey record) => record -> [Update record] -> SqlQueryRep record (Entity record) -- | Constructor corresponding to upsertBy [UpsertBy] :: PersistRecordBackend record SqlBackend => Unique record -> record -> [Update record] -> SqlQueryRep record (Entity record) -- | Constructor corresponding to putMany [PutMany] :: PersistRecordBackend record SqlBackend => [record] -> SqlQueryRep record () -- | Constructor corresponding to insertBy [InsertBy] :: (PersistRecordBackend record SqlBackend, AtLeastOneUniqueKey record) => record -> SqlQueryRep record (Either (Entity record) (Key record)) -- | Constructor corresponding to insertUniqueEntity [InsertUniqueEntity] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to replaceUnique [ReplaceUnique] :: (PersistRecordBackend record SqlBackend, Eq (Unique record), Eq record) => Key record -> record -> SqlQueryRep record (Maybe (Unique record)) -- | Constructor corresponding to onlyUnique [OnlyUnique] :: (PersistRecordBackend record SqlBackend, OnlyOneUniqueKey record) => record -> SqlQueryRep record (Unique record) -- | Constructor corresponding to selectSourceRes [SelectSourceRes] :: (MonadIO m2, PersistRecordBackend record SqlBackend) => [Filter record] -> [SelectOpt record] -> SqlQueryRep record (Acquire (ConduitM () (Entity record) m2 ())) -- | Constructor corresponding to selectFirst [SelectFirst] :: PersistRecordBackend record SqlBackend => [Filter record] -> [SelectOpt record] -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to selectKeysRes [SelectKeysRes] :: (MonadIO m2, PersistRecordBackend record SqlBackend) => [Filter record] -> [SelectOpt record] -> SqlQueryRep record (Acquire (ConduitM () (Key record) m2 ())) -- | Constructor corresponding to count [Count] :: PersistRecordBackend record SqlBackend => [Filter record] -> SqlQueryRep record Int -- | Constructor corresponding to exists [Exists] :: PersistRecordBackend record SqlBackend => [Filter record] -> SqlQueryRep record Bool -- | Constructor corresponding to selectList [SelectList] :: PersistRecordBackend record SqlBackend => [Filter record] -> [SelectOpt record] -> SqlQueryRep record [Entity record] -- | Constructor corresponding to selectKeysList [SelectKeysList] :: PersistRecordBackend record SqlBackend => [Filter record] -> [SelectOpt record] -> SqlQueryRep record [Key record] -- | Constructor corresponding to updateWhere [UpdateWhere] :: PersistRecordBackend record SqlBackend => [Filter record] -> [Update record] -> SqlQueryRep record () -- | Constructor corresponding to deleteWhere [DeleteWhere] :: PersistRecordBackend record SqlBackend => [Filter record] -> SqlQueryRep record () -- | Constructor corresponding to deleteWhereCount [DeleteWhereCount] :: PersistRecordBackend record SqlBackend => [Filter record] -> SqlQueryRep record Int64 -- | Constructor corresponding to updateWhereCount [UpdateWhereCount] :: PersistRecordBackend record SqlBackend => [Filter record] -> [Update record] -> SqlQueryRep record Int64 -- | Constructor corresponding to parseMigration [ParseMigration] :: HasCallStack => Migration -> SqlQueryRep Void (Either [Text] CautiousMigration) -- | Constructor corresponding to parseMigration' [ParseMigration'] :: HasCallStack => Migration -> SqlQueryRep Void CautiousMigration -- | Constructor corresponding to printMigration [PrintMigration] :: HasCallStack => Migration -> SqlQueryRep Void () -- | Constructor corresponding to showMigration [ShowMigration] :: HasCallStack => Migration -> SqlQueryRep Void [Text] -- | Constructor corresponding to getMigration [GetMigration] :: HasCallStack => Migration -> SqlQueryRep Void [Sql] -- | Constructor corresponding to runMigration [RunMigration] :: () => Migration -> SqlQueryRep Void () -- | Constructor corresponding to runMigrationQuiet [RunMigrationQuiet] :: () => Migration -> SqlQueryRep Void [Text] -- | Constructor corresponding to runMigrationSilent [RunMigrationSilent] :: () => Migration -> SqlQueryRep Void [Text] -- | Constructor corresponding to runMigrationUnsafe [RunMigrationUnsafe] :: () => Migration -> SqlQueryRep Void () -- | Constructor corresponding to runMigrationUnsafeQuiet [RunMigrationUnsafeQuiet] :: HasCallStack => Migration -> SqlQueryRep Void [Text] -- | Constructor corresponding to getFieldName [GetFieldName] :: PersistRecordBackend record SqlBackend => EntityField record typ -> SqlQueryRep record Text -- | Constructor corresponding to getTableName [GetTableName] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record Text -- | Constructor corresponding to withRawQuery [WithRawQuery] :: () => Text -> [PersistValue] -> ConduitM [PersistValue] Void IO a -> SqlQueryRep Void a -- | Constructor corresponding to rawQueryRes [RawQueryRes] :: MonadIO m2 => Text -> [PersistValue] -> SqlQueryRep Void (Acquire (ConduitM () [PersistValue] m2 ())) -- | Constructor corresponding to rawExecute [RawExecute] :: () => Text -> [PersistValue] -> SqlQueryRep Void () -- | Constructor corresponding to rawExecuteCount [RawExecuteCount] :: () => Text -> [PersistValue] -> SqlQueryRep Void Int64 -- | Constructor corresponding to rawSql [RawSql] :: RawSql a => Text -> [PersistValue] -> SqlQueryRep Void [a] -- | Constructor corresponding to transactionSave [TransactionSave] :: () => SqlQueryRep Void () -- | Constructor corresponding to transactionSaveWithIsolation [TransactionSaveWithIsolation] :: () => IsolationLevel -> SqlQueryRep Void () -- | Constructor corresponding to transactionUndo [TransactionUndo] :: () => SqlQueryRep Void () -- | Constructor corresponding to transactionUndoWithIsolation [TransactionUndoWithIsolation] :: () => IsolationLevel -> SqlQueryRep Void () -- | A helper to execute the actual persistent function -- corresponding to each SqlQueryRep data constructor. runSqlQueryRep :: MonadUnliftIO m => SqlQueryRep record a -> SqlPersistT m a instance Data.Typeable.Internal.Typeable record => GHC.Show.Show (Database.Persist.Monad.SqlQueryRep.SqlQueryRep record a) -- | Defines the MonadSqlQuery type class that a monad can make an -- instance of in order to interpret how to run a SqlQueryRep sent -- by a lifted function from Database.Persist.Monad.Shim. module Database.Persist.Monad.Class -- | The type-class for monads that can run persistent database queries. class Monad m => MonadSqlQuery m where { type family TransactionM m :: Type -> Type; } -- | Interpret the given SQL query operation. runQueryRep :: (MonadSqlQuery m, Typeable record) => SqlQueryRep record a -> m a -- | Run all queries in the given action using the same database -- connection. withTransaction :: MonadSqlQuery m => TransactionM m a -> m a instance Database.Persist.Monad.Class.MonadSqlQuery m => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.Reader.ReaderT r m) instance Database.Persist.Monad.Class.MonadSqlQuery m => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.Except.ExceptT e m) instance Database.Persist.Monad.Class.MonadSqlQuery m => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.Identity.IdentityT m) instance Database.Persist.Monad.Class.MonadSqlQuery m => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.Maybe.MaybeT m) instance (GHC.Base.Monoid w, Database.Persist.Monad.Class.MonadSqlQuery m) => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.RWS.Lazy.RWST r w s m) instance (GHC.Base.Monoid w, Database.Persist.Monad.Class.MonadSqlQuery m) => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.RWS.Strict.RWST r w s m) instance Database.Persist.Monad.Class.MonadSqlQuery m => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.State.Lazy.StateT s m) instance Database.Persist.Monad.Class.MonadSqlQuery m => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.State.Strict.StateT s m) instance (GHC.Base.Monoid w, Database.Persist.Monad.Class.MonadSqlQuery m) => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance (GHC.Base.Monoid w, Database.Persist.Monad.Class.MonadSqlQuery m) => Database.Persist.Monad.Class.MonadSqlQuery (Control.Monad.Trans.Writer.Strict.WriterT w m) -- | Defines all the persistent functions lifted into -- MonadSqlQuery. -- -- This file is autogenerated, to keep it in sync with -- Database.Persist.Monad.SqlQueryRep. module Database.Persist.Monad.Shim -- | The lifted version of get get :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> m (Maybe record) -- | The lifted version of getMany getMany :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Key record] -> m (Map (Key record) record) -- | The lifted version of getJust getJust :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> m record -- | The lifted version of getJustEntity getJustEntity :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> m (Entity record) -- | The lifted version of getEntity getEntity :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> m (Maybe (Entity record)) -- | The lifted version of belongsTo belongsTo :: (PersistEntity record1, PersistRecordBackend record2 SqlBackend, Typeable record1, Typeable record2, MonadSqlQuery m) => (record1 -> Maybe (Key record2)) -> record1 -> m (Maybe record2) -- | The lifted version of belongsToJust belongsToJust :: (PersistEntity record1, PersistRecordBackend record2 SqlBackend, Typeable record1, Typeable record2, MonadSqlQuery m) => (record1 -> Key record2) -> record1 -> m record2 -- | The lifted version of insert insert :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => record -> m (Key record) -- | The lifted version of insert_ insert_ :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => record -> m () -- | The lifted version of insertMany insertMany :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [record] -> m [Key record] -- | The lifted version of insertMany_ insertMany_ :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [record] -> m () -- | The lifted version of insertEntityMany insertEntityMany :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Entity record] -> m () -- | The lifted version of insertKey insertKey :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> record -> m () -- | The lifted version of repsert repsert :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> record -> m () -- | The lifted version of repsertMany repsertMany :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [(Key record, record)] -> m () -- | The lifted version of replace replace :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> record -> m () -- | The lifted version of delete delete :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> m () -- | The lifted version of update update :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> [Update record] -> m () -- | The lifted version of updateGet updateGet :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Key record -> [Update record] -> m record -- | The lifted version of insertEntity insertEntity :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => record -> m (Entity record) -- | The lifted version of insertRecord insertRecord :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => record -> m record -- | The lifted version of getBy getBy :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Unique record -> m (Maybe (Entity record)) -- | The lifted version of getByValue getByValue :: (PersistRecordBackend record SqlBackend, AtLeastOneUniqueKey record, Typeable record, MonadSqlQuery m) => record -> m (Maybe (Entity record)) -- | The lifted version of checkUnique checkUnique :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => record -> m (Maybe (Unique record)) -- | The lifted version of checkUniqueUpdateable checkUniqueUpdateable :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Entity record -> m (Maybe (Unique record)) -- | The lifted version of deleteBy deleteBy :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Unique record -> m () -- | The lifted version of insertUnique insertUnique :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => record -> m (Maybe (Key record)) -- | The lifted version of upsert upsert :: (PersistRecordBackend record SqlBackend, OnlyOneUniqueKey record, Typeable record, MonadSqlQuery m) => record -> [Update record] -> m (Entity record) -- | The lifted version of upsertBy upsertBy :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => Unique record -> record -> [Update record] -> m (Entity record) -- | The lifted version of putMany putMany :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [record] -> m () -- | The lifted version of insertBy insertBy :: (PersistRecordBackend record SqlBackend, AtLeastOneUniqueKey record, Typeable record, MonadSqlQuery m) => record -> m (Either (Entity record) (Key record)) -- | The lifted version of insertUniqueEntity insertUniqueEntity :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => record -> m (Maybe (Entity record)) -- | The lifted version of replaceUnique replaceUnique :: (PersistRecordBackend record SqlBackend, Eq (Unique record), Eq record, Typeable record, MonadSqlQuery m) => Key record -> record -> m (Maybe (Unique record)) -- | The lifted version of onlyUnique onlyUnique :: (PersistRecordBackend record SqlBackend, OnlyOneUniqueKey record, Typeable record, MonadSqlQuery m) => record -> m (Unique record) -- | The lifted version of selectSourceRes selectSourceRes :: (MonadIO m2, PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> [SelectOpt record] -> m (Acquire (ConduitM () (Entity record) m2 ())) -- | The lifted version of selectFirst selectFirst :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> [SelectOpt record] -> m (Maybe (Entity record)) -- | The lifted version of selectKeysRes selectKeysRes :: (MonadIO m2, PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> [SelectOpt record] -> m (Acquire (ConduitM () (Key record) m2 ())) -- | The lifted version of count count :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> m Int -- | The lifted version of exists exists :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> m Bool -- | The lifted version of selectSource selectSource :: (PersistRecordBackend record SqlBackend, MonadResource m, Typeable record, MonadSqlQuery m) => [Filter record] -> [SelectOpt record] -> ConduitM () (Entity record) m () -- | The lifted version of selectKeys selectKeys :: (PersistRecordBackend record SqlBackend, MonadResource m, Typeable record, MonadSqlQuery m) => [Filter record] -> [SelectOpt record] -> ConduitM () (Key record) m () -- | The lifted version of selectList selectList :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> [SelectOpt record] -> m [Entity record] -- | The lifted version of selectKeysList selectKeysList :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> [SelectOpt record] -> m [Key record] -- | The lifted version of updateWhere updateWhere :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> [Update record] -> m () -- | The lifted version of deleteWhere deleteWhere :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> m () -- | The lifted version of deleteWhereCount deleteWhereCount :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> m Int64 -- | The lifted version of updateWhereCount updateWhereCount :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => [Filter record] -> [Update record] -> m Int64 -- | The lifted version of parseMigration parseMigration :: (HasCallStack, MonadSqlQuery m) => Migration -> m (Either [Text] CautiousMigration) -- | The lifted version of parseMigration' parseMigration' :: (HasCallStack, MonadSqlQuery m) => Migration -> m CautiousMigration -- | The lifted version of printMigration printMigration :: (HasCallStack, MonadSqlQuery m) => Migration -> m () -- | The lifted version of showMigration showMigration :: (HasCallStack, MonadSqlQuery m) => Migration -> m [Text] -- | The lifted version of getMigration getMigration :: (HasCallStack, MonadSqlQuery m) => Migration -> m [Sql] -- | The lifted version of runMigration runMigration :: MonadSqlQuery m => Migration -> m () -- | The lifted version of runMigrationQuiet runMigrationQuiet :: MonadSqlQuery m => Migration -> m [Text] -- | The lifted version of runMigrationSilent runMigrationSilent :: MonadSqlQuery m => Migration -> m [Text] -- | The lifted version of runMigrationUnsafe runMigrationUnsafe :: MonadSqlQuery m => Migration -> m () -- | The lifted version of runMigrationUnsafeQuiet runMigrationUnsafeQuiet :: (HasCallStack, MonadSqlQuery m) => Migration -> m [Text] -- | The lifted version of getFieldName getFieldName :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => EntityField record typ -> m Text -- | The lifted version of getTableName getTableName :: (PersistRecordBackend record SqlBackend, Typeable record, MonadSqlQuery m) => record -> m Text -- | The lifted version of withRawQuery withRawQuery :: MonadSqlQuery m => Text -> [PersistValue] -> ConduitM [PersistValue] Void IO a -> m a -- | The lifted version of rawQueryRes rawQueryRes :: (MonadIO m2, MonadSqlQuery m) => Text -> [PersistValue] -> m (Acquire (ConduitM () [PersistValue] m2 ())) -- | The lifted version of rawQuery rawQuery :: (MonadResource m, MonadSqlQuery m) => Text -> [PersistValue] -> ConduitM () [PersistValue] m () -- | The lifted version of rawExecute rawExecute :: MonadSqlQuery m => Text -> [PersistValue] -> m () -- | The lifted version of rawExecuteCount rawExecuteCount :: MonadSqlQuery m => Text -> [PersistValue] -> m Int64 -- | The lifted version of rawSql rawSql :: (RawSql a, MonadSqlQuery m) => Text -> [PersistValue] -> m [a] -- | The lifted version of transactionSave transactionSave :: MonadSqlQuery m => m () -- | The lifted version of transactionSaveWithIsolation transactionSaveWithIsolation :: MonadSqlQuery m => IsolationLevel -> m () -- | The lifted version of transactionUndo transactionUndo :: MonadSqlQuery m => m () -- | The lifted version of transactionUndoWithIsolation transactionUndoWithIsolation :: MonadSqlQuery m => IsolationLevel -> m () -- | A helper for functions that return a conduit. fromAcquire :: MonadResource m => m (Acquire (ConduitM i o m a)) -> ConduitM i o m a -- | Defines the SqlQueryT monad transformer, which has a -- MonadSqlQuery instance to execute persistent database -- operations. Also provides easy transaction management with -- withTransaction, which supports retrying with exponential -- backoff and restricts IO actions to only allow IO actions explicitly -- marked as rerunnable. -- -- Usage: -- --
--   myFunction :: (MonadSqlQuery m, MonadIO m) => m ()
--   myFunction = do
--     insert_ $ Person { name = "Alice", age = Just 25 }
--     insert_ $ Person { name = "Bob", age = Nothing }
--   
--     -- some other business logic
--   
--     personList <- selectList [] []
--     liftIO $ print (personList :: [Person])
--   
--     -- everything in here will run in a transaction
--     withTransaction $ do
--       selectFirst [PersonAge >. 30] [] >>= \case
--         Nothing -> insert_ $ Person { name = "Claire", age = Just 50 }
--         Just (Entity key person) -> replace key person{ age = Just (age person - 10) }
--   
--       -- liftIO doesn't work in here, since transactions can be retried.
--       -- Use rerunnableIO to run IO actions, after verifying that the IO action
--       -- can be rerun if the transaction needs to be retried.
--       rerunnableIO $ putStrLn "Transaction is finished!"
--   
--     -- some more business logic
--   
--     return ()
--   
module Database.Persist.Monad -- | The type-class for monads that can run persistent database queries. class Monad m => MonadSqlQuery m -- | Run all queries in the given action using the same database -- connection. withTransaction :: MonadSqlQuery m => TransactionM m a -> m a -- | The monad transformer that implements MonadSqlQuery. data SqlQueryT m a -- | Run the SqlQueryT monad transformer with the given backend. runSqlQueryT :: Pool SqlBackend -> SqlQueryT m a -> m a -- | Run the SqlQueryT monad transformer with the explicitly -- provided environment. runSqlQueryTWith :: SqlQueryEnv -> SqlQueryT m a -> m a -- | Environment to configure running SqlQueryT. -- -- For simple usage, you can just use runSqlQueryT, but for more -- advanced usage, including the ability to retry transactions, use -- mkSqlQueryEnv with runSqlQueryTWith. data SqlQueryEnv SqlQueryEnv :: Pool SqlBackend -> (SomeException -> Bool) -> Int -> SqlQueryEnv -- | The pool for your persistent backend. Get this from -- withSqlitePool or the equivalent for your backend. [backendPool] :: SqlQueryEnv -> Pool SqlBackend -- | Retry a transaction when an exception matches this predicate. Will -- retry with an exponential backoff. -- -- Defaults to always returning False (i.e. never retry) [retryIf] :: SqlQueryEnv -> SomeException -> Bool -- | The number of times to retry, if retryIf is satisfied. -- -- Defaults to 10. [retryLimit] :: SqlQueryEnv -> Int -- | Build a SqlQueryEnv from the default. -- -- Usage: -- --
--   let env = mkSqlQueryEnv pool $ \env -> env { retryIf = 10 }
--   in runSqlQueryTWith env m
--   
mkSqlQueryEnv :: Pool SqlBackend -> (SqlQueryEnv -> SqlQueryEnv) -> SqlQueryEnv -- | The monad that tracks transaction state. -- -- Conceptually equivalent to SqlPersistT, but restricts IO -- operations, for two reasons: 1. Forking a thread that uses the same -- SqlBackend as the current thread causes Bad Things to happen. -- 2. Transactions may need to be retried, in which case IO operations in -- a transaction are required to be rerunnable. -- -- You shouldn't need to explicitly use this type; your functions should -- only declare the MonadSqlQuery constraint. data SqlTransaction m a -- | SqlTransaction does not have an instance for MonadTrans -- to prevent accidental lifting of unsafe monadic actions. Use this -- function to explicitly mark a monadic action as rerunnable. rerunnableLift :: MonadUnliftIO m => m a -> SqlTransaction m a -- | Errors that can occur within a SQL transaction. data TransactionError -- | The retry limit was reached when retrying a transaction. RetryLimitExceeded :: TransactionError instance Control.Monad.IO.Rerunnable.MonadRerunnableIO m => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Database.Persist.Monad.SqlTransaction m) instance GHC.Base.Monad m => GHC.Base.Monad (Database.Persist.Monad.SqlTransaction m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Database.Persist.Monad.SqlTransaction m) instance GHC.Base.Functor m => GHC.Base.Functor (Database.Persist.Monad.SqlTransaction m) instance GHC.Classes.Eq Database.Persist.Monad.TransactionError instance GHC.Show.Show Database.Persist.Monad.TransactionError instance Control.Monad.IO.Rerunnable.MonadRerunnableIO m => Control.Monad.IO.Rerunnable.MonadRerunnableIO (Database.Persist.Monad.SqlQueryT m) instance Control.Monad.Trans.Resource.Internal.MonadResource m => Control.Monad.Trans.Resource.Internal.MonadResource (Database.Persist.Monad.SqlQueryT m) instance Control.Monad.Trans.Class.MonadTrans Database.Persist.Monad.SqlQueryT instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Database.Persist.Monad.SqlQueryT m) instance GHC.Base.Monad m => GHC.Base.Monad (Database.Persist.Monad.SqlQueryT m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Database.Persist.Monad.SqlQueryT m) instance GHC.Base.Functor m => GHC.Base.Functor (Database.Persist.Monad.SqlQueryT m) instance Control.Monad.IO.Unlift.MonadUnliftIO m => Database.Persist.Monad.Class.MonadSqlQuery (Database.Persist.Monad.SqlQueryT m) instance Control.Monad.IO.Unlift.MonadUnliftIO m => Control.Monad.IO.Unlift.MonadUnliftIO (Database.Persist.Monad.SqlQueryT m) instance GHC.Exception.Type.Exception Database.Persist.Monad.TransactionError instance ((TypeError ...), GHC.Base.Monad m) => Control.Monad.IO.Class.MonadIO (Database.Persist.Monad.SqlTransaction m) instance (Database.Persist.Monad.Class.MonadSqlQuery m, Control.Monad.IO.Unlift.MonadUnliftIO m) => Database.Persist.Monad.Class.MonadSqlQuery (Database.Persist.Monad.SqlTransaction m) -- | Defines MockSqlQueryT, which one can use in tests in order to -- mock out persistent database queries called in production -- code. module Database.Persist.Monad.TestUtils -- | A monad transformer for testing functions that use -- MonadSqlQuery. data MockSqlQueryT m a -- | Runs a MockSqlQueryT monad transformer using the given mocks. -- -- When a database query is executed, the first mock that returns a -- Just is returned. If no mocks match the query, an error is -- thrown. See SqlQueryRep for the constructors available to match -- against. Most of the time, you'll want to use withRecord to -- only match queries against a specific record type (e.g. only -- match selectList calls for the Person entity). -- -- Usage: -- --
--   myFunction :: MonadSqlQuery m => m [String]
--   myFunction = map personName $ selectList [PersonAge >. 25] []
--   
--   let persons = [Person ...]
--   result <- runMockSqlQueryT myFunction
--     [ withRecord @Person $ \case
--         SelectList _ _ -> Just persons
--         _ -> Nothing
--     , withRecord @Post $ \case
--         Insert Post{ name = "post1" } -> Just $ toSqlKey 1
--         _ -> Nothing
--     , mockQuery $ \case
--         RawExecuteCount "DELETE FROM person WHERE name = 'Alice'" [] -> Just 1
--         _ -> Nothing
--     ]
--   
runMockSqlQueryT :: MockSqlQueryT m a -> [MockQuery] -> m a -- | A helper for defining a mocked database query against a specific -- record type. Designed to be used with TypeApplications. -- -- Most SqlQueryRep constructors are in the context of a specific -- record type, like Person. This helper only matches -- mocked database queries that are querying the record you specify. -- -- Some constructors reference multiple record types, like -- BelongsTo. Look at the type to see the record you need to match -- against. For example, -- --
--   withRecord @(Person, Post) $ \case
--     BelongsTo _ _ -> ...
--   
-- -- would match the function call -- --
--   belongsTo :: (Person -> Maybe (Key Post)) -> Person -> SqlQueryRep (Person, Post) (Maybe Post)
--   
withRecord :: forall record. Typeable record => (forall a. SqlQueryRep record a -> Maybe a) -> MockQuery -- | A helper for defining a mocked database query. -- -- This does not do any matching on the record type, so it is -- mostly useful for queries that don't use the record type, -- like rawExecute. mockQuery :: (forall record a. Typeable record => SqlQueryRep record a -> Maybe a) -> MockQuery -- | A mocked query to use in runMockSqlQueryT. -- -- Use withRecord or another helper to create a MockQuery. data MockQuery -- | A helper for mocking a selectSource or selectSourceRes -- call. -- -- Usage: -- --
--   mockSelectSource $ \filters opts ->
--     if null filters && null opts
--       then
--         let person1 = [Entity (toSqlKey 1) $ Person "Alice"]
--             person2 = [Entity (toSqlKey 2) $ Person "Bob"]
--         in Just [person1, person2]
--       else Nothing
--   
mockSelectSource :: forall record. Typeable record => ([Filter record] -> [SelectOpt record] -> Maybe [Entity record]) -> MockQuery -- | A helper for mocking a selectKeys or selectKeysRes call. -- -- Usage: -- --
--   mockSelectKeys $ \filters opts ->
--     if null filters && null opts
--       then Just $ map toSqlKey [1, 2]
--       else Nothing
--   
mockSelectKeys :: forall record. Typeable record => ([Filter record] -> [SelectOpt record] -> Maybe [Key record]) -> MockQuery -- | A helper for mocking a withRawQuery call. -- -- Usage: -- --
--   mockWithRawQuery $ \sql vals ->
--     if sql == "SELECT id, name FROM person"
--       then
--         let row1 = [toPersistValue 1, toPersistValue "Alice"]
--             row2 = [toPersistValue 2, toPersistValue "Bob"]
--         in Just [row1, row2]
--       else Nothing
--   
mockWithRawQuery :: (Text -> [PersistValue] -> Maybe [[PersistValue]]) -> MockQuery -- | A helper for mocking a rawQuery or rawQueryRes call. -- -- Usage: -- --
--   mockRawQuery $ \sql vals ->
--     if sql == "SELECT id, name FROM person"
--       then
--         let row1 = [toPersistValue 1, toPersistValue "Alice"]
--             row2 = [toPersistValue 2, toPersistValue "Bob"]
--         in Just [row1, row2]
--       else Nothing
--   
mockRawQuery :: (Text -> [PersistValue] -> Maybe [[PersistValue]]) -> MockQuery -- | A helper for mocking a rawSql call. -- -- Usage: -- --
--   mockRawSql $ \sql vals ->
--     if sql == "SELECT id, name FROM person"
--       then
--         let row1 = [toPersistValue 1, toPersistValue "Alice"]
--             row2 = [toPersistValue 2, toPersistValue "Bob"]
--         in Just [row1, row2]
--       else Nothing
--   
mockRawSql :: (Text -> [PersistValue] -> Maybe [[PersistValue]]) -> MockQuery -- | The data type containing a constructor for each persistent function -- we'd like to lift into MonadSqlQuery. -- -- The record type parameter contains the PersistEntity -- types used in a given function. -- -- We're using a free-monads-like technique here to allow us to -- introspect persistent functions in MonadSqlQuery, e.g. to mock -- out persistent calls in tests. data SqlQueryRep record a -- | Constructor corresponding to get [Get] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record (Maybe record) -- | Constructor corresponding to getMany [GetMany] :: PersistRecordBackend record SqlBackend => [Key record] -> SqlQueryRep record (Map (Key record) record) -- | Constructor corresponding to getJust [GetJust] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record record -- | Constructor corresponding to getJustEntity [GetJustEntity] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record (Entity record) -- | Constructor corresponding to getEntity [GetEntity] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to belongsTo [BelongsTo] :: (PersistEntity record1, PersistRecordBackend record2 SqlBackend) => (record1 -> Maybe (Key record2)) -> record1 -> SqlQueryRep (record1, record2) (Maybe record2) -- | Constructor corresponding to belongsToJust [BelongsToJust] :: (PersistEntity record1, PersistRecordBackend record2 SqlBackend) => (record1 -> Key record2) -> record1 -> SqlQueryRep (record1, record2) record2 -- | Constructor corresponding to insert [Insert] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Key record) -- | Constructor corresponding to insert_ [Insert_] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record () -- | Constructor corresponding to insertMany [InsertMany] :: PersistRecordBackend record SqlBackend => [record] -> SqlQueryRep record [Key record] -- | Constructor corresponding to insertMany_ [InsertMany_] :: PersistRecordBackend record SqlBackend => [record] -> SqlQueryRep record () -- | Constructor corresponding to insertEntityMany [InsertEntityMany] :: PersistRecordBackend record SqlBackend => [Entity record] -> SqlQueryRep record () -- | Constructor corresponding to insertKey [InsertKey] :: PersistRecordBackend record SqlBackend => Key record -> record -> SqlQueryRep record () -- | Constructor corresponding to repsert [Repsert] :: PersistRecordBackend record SqlBackend => Key record -> record -> SqlQueryRep record () -- | Constructor corresponding to repsertMany [RepsertMany] :: PersistRecordBackend record SqlBackend => [(Key record, record)] -> SqlQueryRep record () -- | Constructor corresponding to replace [Replace] :: PersistRecordBackend record SqlBackend => Key record -> record -> SqlQueryRep record () -- | Constructor corresponding to delete [Delete] :: PersistRecordBackend record SqlBackend => Key record -> SqlQueryRep record () -- | Constructor corresponding to update [Update] :: PersistRecordBackend record SqlBackend => Key record -> [Update record] -> SqlQueryRep record () -- | Constructor corresponding to updateGet [UpdateGet] :: PersistRecordBackend record SqlBackend => Key record -> [Update record] -> SqlQueryRep record record -- | Constructor corresponding to insertEntity [InsertEntity] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Entity record) -- | Constructor corresponding to insertRecord [InsertRecord] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record record -- | Constructor corresponding to getBy [GetBy] :: PersistRecordBackend record SqlBackend => Unique record -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to getByValue [GetByValue] :: (PersistRecordBackend record SqlBackend, AtLeastOneUniqueKey record) => record -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to checkUnique [CheckUnique] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Maybe (Unique record)) -- | Constructor corresponding to checkUniqueUpdateable [CheckUniqueUpdateable] :: PersistRecordBackend record SqlBackend => Entity record -> SqlQueryRep record (Maybe (Unique record)) -- | Constructor corresponding to deleteBy [DeleteBy] :: PersistRecordBackend record SqlBackend => Unique record -> SqlQueryRep record () -- | Constructor corresponding to insertUnique [InsertUnique] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Maybe (Key record)) -- | Constructor corresponding to upsert [Upsert] :: (PersistRecordBackend record SqlBackend, OnlyOneUniqueKey record) => record -> [Update record] -> SqlQueryRep record (Entity record) -- | Constructor corresponding to upsertBy [UpsertBy] :: PersistRecordBackend record SqlBackend => Unique record -> record -> [Update record] -> SqlQueryRep record (Entity record) -- | Constructor corresponding to putMany [PutMany] :: PersistRecordBackend record SqlBackend => [record] -> SqlQueryRep record () -- | Constructor corresponding to insertBy [InsertBy] :: (PersistRecordBackend record SqlBackend, AtLeastOneUniqueKey record) => record -> SqlQueryRep record (Either (Entity record) (Key record)) -- | Constructor corresponding to insertUniqueEntity [InsertUniqueEntity] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to replaceUnique [ReplaceUnique] :: (PersistRecordBackend record SqlBackend, Eq (Unique record), Eq record) => Key record -> record -> SqlQueryRep record (Maybe (Unique record)) -- | Constructor corresponding to onlyUnique [OnlyUnique] :: (PersistRecordBackend record SqlBackend, OnlyOneUniqueKey record) => record -> SqlQueryRep record (Unique record) -- | Constructor corresponding to selectSourceRes [SelectSourceRes] :: (MonadIO m2, PersistRecordBackend record SqlBackend) => [Filter record] -> [SelectOpt record] -> SqlQueryRep record (Acquire (ConduitM () (Entity record) m2 ())) -- | Constructor corresponding to selectFirst [SelectFirst] :: PersistRecordBackend record SqlBackend => [Filter record] -> [SelectOpt record] -> SqlQueryRep record (Maybe (Entity record)) -- | Constructor corresponding to selectKeysRes [SelectKeysRes] :: (MonadIO m2, PersistRecordBackend record SqlBackend) => [Filter record] -> [SelectOpt record] -> SqlQueryRep record (Acquire (ConduitM () (Key record) m2 ())) -- | Constructor corresponding to count [Count] :: PersistRecordBackend record SqlBackend => [Filter record] -> SqlQueryRep record Int -- | Constructor corresponding to exists [Exists] :: PersistRecordBackend record SqlBackend => [Filter record] -> SqlQueryRep record Bool -- | Constructor corresponding to selectList [SelectList] :: PersistRecordBackend record SqlBackend => [Filter record] -> [SelectOpt record] -> SqlQueryRep record [Entity record] -- | Constructor corresponding to selectKeysList [SelectKeysList] :: PersistRecordBackend record SqlBackend => [Filter record] -> [SelectOpt record] -> SqlQueryRep record [Key record] -- | Constructor corresponding to updateWhere [UpdateWhere] :: PersistRecordBackend record SqlBackend => [Filter record] -> [Update record] -> SqlQueryRep record () -- | Constructor corresponding to deleteWhere [DeleteWhere] :: PersistRecordBackend record SqlBackend => [Filter record] -> SqlQueryRep record () -- | Constructor corresponding to deleteWhereCount [DeleteWhereCount] :: PersistRecordBackend record SqlBackend => [Filter record] -> SqlQueryRep record Int64 -- | Constructor corresponding to updateWhereCount [UpdateWhereCount] :: PersistRecordBackend record SqlBackend => [Filter record] -> [Update record] -> SqlQueryRep record Int64 -- | Constructor corresponding to parseMigration [ParseMigration] :: HasCallStack => Migration -> SqlQueryRep Void (Either [Text] CautiousMigration) -- | Constructor corresponding to parseMigration' [ParseMigration'] :: HasCallStack => Migration -> SqlQueryRep Void CautiousMigration -- | Constructor corresponding to printMigration [PrintMigration] :: HasCallStack => Migration -> SqlQueryRep Void () -- | Constructor corresponding to showMigration [ShowMigration] :: HasCallStack => Migration -> SqlQueryRep Void [Text] -- | Constructor corresponding to getMigration [GetMigration] :: HasCallStack => Migration -> SqlQueryRep Void [Sql] -- | Constructor corresponding to runMigration [RunMigration] :: () => Migration -> SqlQueryRep Void () -- | Constructor corresponding to runMigrationQuiet [RunMigrationQuiet] :: () => Migration -> SqlQueryRep Void [Text] -- | Constructor corresponding to runMigrationSilent [RunMigrationSilent] :: () => Migration -> SqlQueryRep Void [Text] -- | Constructor corresponding to runMigrationUnsafe [RunMigrationUnsafe] :: () => Migration -> SqlQueryRep Void () -- | Constructor corresponding to runMigrationUnsafeQuiet [RunMigrationUnsafeQuiet] :: HasCallStack => Migration -> SqlQueryRep Void [Text] -- | Constructor corresponding to getFieldName [GetFieldName] :: PersistRecordBackend record SqlBackend => EntityField record typ -> SqlQueryRep record Text -- | Constructor corresponding to getTableName [GetTableName] :: PersistRecordBackend record SqlBackend => record -> SqlQueryRep record Text -- | Constructor corresponding to withRawQuery [WithRawQuery] :: () => Text -> [PersistValue] -> ConduitM [PersistValue] Void IO a -> SqlQueryRep Void a -- | Constructor corresponding to rawQueryRes [RawQueryRes] :: MonadIO m2 => Text -> [PersistValue] -> SqlQueryRep Void (Acquire (ConduitM () [PersistValue] m2 ())) -- | Constructor corresponding to rawExecute [RawExecute] :: () => Text -> [PersistValue] -> SqlQueryRep Void () -- | Constructor corresponding to rawExecuteCount [RawExecuteCount] :: () => Text -> [PersistValue] -> SqlQueryRep Void Int64 -- | Constructor corresponding to rawSql [RawSql] :: RawSql a => Text -> [PersistValue] -> SqlQueryRep Void [a] -- | Constructor corresponding to transactionSave [TransactionSave] :: () => SqlQueryRep Void () -- | Constructor corresponding to transactionSaveWithIsolation [TransactionSaveWithIsolation] :: () => IsolationLevel -> SqlQueryRep Void () -- | Constructor corresponding to transactionUndo [TransactionUndo] :: () => SqlQueryRep Void () -- | Constructor corresponding to transactionUndoWithIsolation [TransactionUndoWithIsolation] :: () => IsolationLevel -> SqlQueryRep Void () instance Control.Monad.Trans.Resource.Internal.MonadResource m => Control.Monad.Trans.Resource.Internal.MonadResource (Database.Persist.Monad.TestUtils.MockSqlQueryT m) instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (Database.Persist.Monad.TestUtils.MockSqlQueryT m) instance GHC.Base.Monad m => GHC.Base.Monad (Database.Persist.Monad.TestUtils.MockSqlQueryT m) instance GHC.Base.Applicative m => GHC.Base.Applicative (Database.Persist.Monad.TestUtils.MockSqlQueryT m) instance GHC.Base.Functor m => GHC.Base.Functor (Database.Persist.Monad.TestUtils.MockSqlQueryT m) instance Control.Monad.IO.Class.MonadIO m => Database.Persist.Monad.Class.MonadSqlQuery (Database.Persist.Monad.TestUtils.MockSqlQueryT m)