-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Some helpers for using Persistent from Yesod.
--
@package yesod-persistent
@version 1.4.0
-- | Defines the core functionality of this package. This package is
-- distinguished from Yesod.Persist in that the latter additionally
-- exports the persistent modules themselves.
module Yesod.Persist.Core
class Monad (YesodDB site) => YesodPersist site where type family YesodPersistBackend site
runDB :: YesodPersist site => YesodDB site a -> HandlerT site IO a
-- | Helper for creating runDB.
--
-- Since 1.2.0
defaultRunDB :: PersistConfig c => (site -> c) -> (site -> PersistConfigPool c) -> PersistConfigBackend c (HandlerT site IO) a -> HandlerT site IO a
-- | Since 1.2.0
class YesodPersist site => YesodPersistRunner site
getDBRunner :: YesodPersistRunner site => HandlerT site IO (DBRunner site, HandlerT site IO ())
-- | Helper for implementing getDBRunner.
--
-- Since 1.2.0
defaultGetDBRunner :: YesodPersistBackend site ~ SqlBackend => (site -> Pool Connection) -> HandlerT site IO (DBRunner site, HandlerT site IO ())
newtype DBRunner site
DBRunner :: (forall a. YesodDB site a -> HandlerT site IO a) -> DBRunner site
runDBRunner :: DBRunner site -> forall a. YesodDB site a -> HandlerT site IO a
-- | Like runDB, but transforms a Source. See
-- respondSourceDB for an example, practical use case.
--
-- Since 1.2.0
runDBSource :: YesodPersistRunner site => Source (YesodDB site) a -> Source (HandlerT site IO) a
-- | Extends respondSource to create a streaming database response
-- body.
respondSourceDB :: YesodPersistRunner site => ContentType -> Source (YesodDB site) (Flush Builder) -> HandlerT site IO TypedContent
type YesodDB site = ReaderT (YesodPersistBackend site) (HandlerT site IO)
-- | Get the given entity by ID, or return a 404 not found if it doesn't
-- exist.
get404 :: (MonadIO m, PersistStore (PersistEntityBackend val), PersistEntity val) => Key val -> ReaderT (PersistEntityBackend val) m val
-- | Get the given entity by unique key, or return a 404 not found if it
-- doesn't exist.
getBy404 :: (PersistUnique (PersistEntityBackend val), PersistEntity val, MonadIO m) => Unique val -> ReaderT (PersistEntityBackend val) m (Entity val)
module Yesod.Persist