mu-persistent 0.3.0.0 → 0.3.1.0
raw patch · 2 files changed
+19/−8 lines, 2 filesdep +resource-pooldep ~basedep ~monad-loggerdep ~mu-schemaPVP ok
version bump matches the API change (PVP)
Dependencies added: resource-pool
Dependency ranges changed: base, monad-logger, mu-schema, persistent, resourcet, transformers
API changes (from Hackage documentation)
+ Mu.Adapter.Persistent: data Pool a
+ Mu.Adapter.Persistent: runDbPool :: MonadIO m => Pool SqlBackend -> ReaderT SqlBackend (NoLoggingT (ResourceT IO)) a -> m a
Files
- mu-persistent.cabal +8/−7
- src/Mu/Adapter/Persistent.hs +11/−1
mu-persistent.cabal view
@@ -1,5 +1,5 @@ name: mu-persistent-version: 0.3.0.0+version: 0.3.1.0 synopsis: Utilities for interoperation between Mu and Persistent description: Please see the <https://github.com/higherkindness/mu-haskell/persistent#readme readme file>.@@ -27,11 +27,12 @@ hs-source-dirs: src default-language: Haskell2010 build-depends:- base >=4.7 && <5- , monad-logger- , mu-schema >=0.3.0- , persistent- , resourcet- , transformers+ base >=4.12 && <5+ , monad-logger >=0.3 && <0.4+ , mu-schema ==0.3.*+ , persistent >=2.10 && <3+ , resourcet >=1.2 && <2+ , resource-pool >=0.2 && <0.3+ , transformers >=0.5 && <0.6 ghc-options: -Wall
src/Mu/Adapter/Persistent.hs view
@@ -21,7 +21,7 @@ WithEntityNestedId(..) , WithEntityPlainId(..) -- * Generic utilities-, runDb+, runDb, Pool, runDbPool ) where import Control.Monad.IO.Class@@ -29,6 +29,7 @@ import Control.Monad.Trans.Reader import Control.Monad.Trans.Resource.Internal import Data.Int+import Data.Pool (Pool) import Database.Persist.Sql import GHC.Generics import GHC.TypeLits@@ -95,3 +96,12 @@ -> ReaderT SqlBackend (NoLoggingT (ResourceT IO)) a -> m a runDb = (liftIO .) . flip runSqlPersistM++-- | Simple utility to execute a database operation+-- in any monad which supports 'IO' operations.+-- Note that all logging messages are discarded.+runDbPool :: MonadIO m+ => Pool SqlBackend+ -> ReaderT SqlBackend (NoLoggingT (ResourceT IO)) a+ -> m a+runDbPool = (liftIO .) . flip runSqlPersistMPool