yesod-persistent 1.4.3 → 1.6.0
raw patch · 4 files changed
+59/−62 lines, 4 filesdep ~persistentdep ~persistent-sqlitedep ~yesod-core
Dependency ranges changed: persistent, persistent-sqlite, yesod-core
Files
- ChangeLog.md +4/−0
- Yesod/Persist/Core.hs +12/−12
- test/Yesod/PersistSpec.hs +1/−1
- yesod-persistent.cabal +42/−49
ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.6.0++* Upgrade to yesod-core 1.6.0+ ## 1.4.3 * Fix overly powerful constraints on get404 and getBy404.
Yesod/Persist/Core.hs view
@@ -37,11 +37,11 @@ unSqlPersistT :: a -> a unSqlPersistT = id -type YesodDB site = ReaderT (YesodPersistBackend site) (HandlerT site IO)+type YesodDB site = ReaderT (YesodPersistBackend site) (HandlerFor site) class Monad (YesodDB site) => YesodPersist site where type YesodPersistBackend site- runDB :: YesodDB site a -> HandlerT site IO a+ runDB :: YesodDB site a -> HandlerFor site a -- | Helper for creating 'runDB'. --@@ -49,8 +49,8 @@ defaultRunDB :: PersistConfig c => (site -> c) -> (site -> PersistConfigPool c)- -> PersistConfigBackend c (HandlerT site IO) a- -> HandlerT site IO a+ -> PersistConfigBackend c (HandlerFor site) a+ -> HandlerFor site a defaultRunDB getConfig getPool f = do master <- getYesod Database.Persist.runPool@@ -74,10 +74,10 @@ -- least, a rollback will be used instead. -- -- Since 1.2.0- getDBRunner :: HandlerT site IO (DBRunner site, HandlerT site IO ())+ getDBRunner :: HandlerFor site (DBRunner site, HandlerFor site ()) newtype DBRunner site = DBRunner- { runDBRunner :: forall a. YesodDB site a -> HandlerT site IO a+ { runDBRunner :: forall a. YesodDB site a -> HandlerFor site a } -- | Helper for implementing 'getDBRunner'.@@ -86,11 +86,11 @@ #if MIN_VERSION_persistent(2,5,0) defaultGetDBRunner :: (SQL.IsSqlBackend backend, YesodPersistBackend site ~ backend) => (site -> Pool backend)- -> HandlerT site IO (DBRunner site, HandlerT site IO ())+ -> HandlerFor site (DBRunner site, HandlerFor site ()) #else defaultGetDBRunner :: YesodPersistBackend site ~ SQL.SqlBackend => (site -> Pool SQL.SqlBackend)- -> HandlerT site IO (DBRunner site, HandlerT site IO ())+ -> HandlerFor site (DBRunner site, HandlerFor site ()) #endif defaultGetDBRunner getPool = do pool <- fmap getPool getYesod@@ -118,8 +118,8 @@ -- -- Since 1.2.0 runDBSource :: YesodPersistRunner site- => Source (YesodDB site) a- -> Source (HandlerT site IO) a+ => ConduitT () a (YesodDB site) ()+ -> ConduitT () a (HandlerFor site) () runDBSource src = do (dbrunner, cleanup) <- lift getDBRunner transPipe (runDBRunner dbrunner) src@@ -128,8 +128,8 @@ -- | Extends 'respondSource' to create a streaming database response body. respondSourceDB :: YesodPersistRunner site => ContentType- -> Source (YesodDB site) (Flush Builder)- -> HandlerT site IO TypedContent+ -> ConduitT () (Flush Builder) (YesodDB site) ()+ -> HandlerFor site TypedContent respondSourceDB ctype = respondSource ctype . runDBSource -- | Get the given entity by ID, or return a 404 not found if it doesn't exist.
test/Yesod/PersistSpec.hs view
@@ -45,7 +45,7 @@ insert_ $ Person "Charlie" insert_ $ Person "Alice" insert_ $ Person "Bob"- respondSourceDB typePlain $ selectSource [] [Asc PersonName] $= awaitForever toBuilder+ respondSourceDB typePlain $ selectSource [] [Asc PersonName] .| awaitForever toBuilder where toBuilder (Entity _ (Person name)) = do yield $ Chunk $ fromText name
yesod-persistent.cabal view
@@ -1,55 +1,48 @@-name: yesod-persistent-version: 1.4.3-cabal-version: >=1.8-build-type: Simple-license: MIT-license-file: LICENSE-maintainer: Michael Snoyman <michael@snoyman.com>-stability: Stable-homepage: http://www.yesodweb.com/-synopsis: Some helpers for using Persistent from Yesod.-description:- API docs and the README are available at <http://www.stackage.org/package/yesod-persistent>-category: Web, Yesod, Database-author: Michael Snoyman <michael@snoyman.com>-extra-source-files:- README.md- ChangeLog.md--source-repository head- type: git- location: https://github.com/yesodweb/yesod+name: yesod-persistent+version: 1.6.0+license: MIT+license-file: LICENSE+author: Michael Snoyman <michael@snoyman.com>+maintainer: Michael Snoyman <michael@snoyman.com>+synopsis: Some helpers for using Persistent from Yesod.+category: Web, Yesod, Database+stability: Stable+cabal-version: >= 1.8+build-type: Simple+homepage: http://www.yesodweb.com/+description: API docs and the README are available at <http://www.stackage.org/package/yesod-persistent>+extra-source-files: README.md ChangeLog.md library- exposed-modules:- Yesod.Persist- Yesod.Persist.Core- build-depends:- base ==4.*,- yesod-core >=1.4.0 && <1.5,- persistent >=2.1 && <2.8,- persistent-template >=2.1 && <2.8,- transformers >=0.2.2,- blaze-builder -any,- conduit -any,- resourcet >=0.4.5,- resource-pool -any- ghc-options: -Wall+ build-depends: base >= 4 && < 5+ , yesod-core >= 1.6 && < 1.7+ , persistent >= 2.8 && < 2.9+ , persistent-template >= 2.1 && < 2.8+ , transformers >= 0.2.2+ , blaze-builder+ , conduit+ , resourcet >= 0.4.5+ , resource-pool+ exposed-modules: Yesod.Persist+ Yesod.Persist.Core+ ghc-options: -Wall -test-suite test+test-suite test type: exitcode-stdio-1.0 main-is: Spec.hs- build-depends:- base -any,- hspec -any,- wai-extra -any,- yesod-core -any,- persistent-sqlite -any,- yesod-persistent -any,- conduit -any,- blaze-builder -any,- persistent -any,- text -any hs-source-dirs: test- other-modules:- Yesod.PersistSpec+ other-modules: Yesod.PersistSpec+ build-depends: base+ , hspec+ , wai-extra+ , yesod-core+ , persistent-sqlite >= 2.8+ , yesod-persistent+ , conduit+ , blaze-builder+ , persistent+ , text++source-repository head+ type: git+ location: https://github.com/yesodweb/yesod