Adjust yesod-persistent for split DB
This commit is contained in:
parent
d8414c3c20
commit
7b35665d73
@ -20,7 +20,7 @@ module Yesod.Persist.Core
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Database.Persist
|
import Database.Persist
|
||||||
import Control.Monad.Trans.Reader (ReaderT, runReaderT)
|
import Control.Monad.Trans.Reader (ReaderT, runReaderT, withReaderT)
|
||||||
|
|
||||||
import Yesod.Core
|
import Yesod.Core
|
||||||
import Data.Conduit
|
import Data.Conduit
|
||||||
@ -124,9 +124,9 @@ respondSourceDB :: YesodPersistRunner site
|
|||||||
respondSourceDB ctype = respondSource ctype . runDBSource
|
respondSourceDB ctype = respondSource ctype . runDBSource
|
||||||
|
|
||||||
-- | Get the given entity by ID, or return a 404 not found if it doesn't exist.
|
-- | 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)
|
get404 :: (MonadIO m, PersistStore backend, BaseBackend backend ~ PersistEntityBackend val, PersistEntity val)
|
||||||
=> Key val
|
=> Key val
|
||||||
-> ReaderT (PersistEntityBackend val) m val
|
-> ReaderT backend m val
|
||||||
get404 key = do
|
get404 key = do
|
||||||
mres <- get key
|
mres <- get key
|
||||||
case mres of
|
case mres of
|
||||||
@ -135,9 +135,9 @@ get404 key = do
|
|||||||
|
|
||||||
-- | Get the given entity by unique key, or return a 404 not found if it doesn't
|
-- | Get the given entity by unique key, or return a 404 not found if it doesn't
|
||||||
-- exist.
|
-- exist.
|
||||||
getBy404 :: (PersistUnique (PersistEntityBackend val), PersistEntity val, MonadIO m)
|
getBy404 :: (PersistUnique backend, BaseBackend backend ~ PersistEntityBackend val, PersistEntity val, MonadIO m)
|
||||||
=> Unique val
|
=> Unique val
|
||||||
-> ReaderT (PersistEntityBackend val) m (Entity val)
|
-> ReaderT backend m (Entity val)
|
||||||
getBy404 key = do
|
getBy404 key = do
|
||||||
mres <- getBy key
|
mres <- getBy key
|
||||||
case mres of
|
case mres of
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user