groundhog-postgresql 0.8.0.3 → 0.9.0
raw patch · 4 files changed
+32/−7 lines, 4 filesdep +semigroupsdep ~groundhogPVP ok
version bump matches the API change (PVP)
Dependencies added: semigroups
Dependency ranges changed: groundhog
API changes (from Hackage documentation)
Files
- Database/Groundhog/Postgresql.hs +21/−4
- Database/Groundhog/Postgresql/Array.hs +1/−1
- changelog +3/−0
- groundhog-postgresql.cabal +7/−2
Database/Groundhog/Postgresql.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE ScopedTypeVariables, FlexibleInstances, FlexibleContexts, OverloadedStrings, TypeFamilies, MultiParamTypeClasses, TemplateHaskell #-}+ module Database.Groundhog.Postgresql ( withPostgresqlPool , withPostgresqlConn@@ -48,10 +49,14 @@ import Data.IORef import Data.List (groupBy, intercalate, isPrefixOf, stripPrefix) import Data.Maybe (fromJust, fromMaybe, isJust, mapMaybe)-import Data.Monoid+import Data.Monoid hiding ((<>)) import Data.Pool import Data.Time.LocalTime (localTimeToUTC, utc) +-- work around for no Semigroup instance of PG.Query prior to+-- postgresql-simple 0.5.3.0+import qualified Data.ByteString as B+ -- typical operations for connection: OPEN, BEGIN, COMMIT, ROLLBACK, CLOSE newtype Postgresql = Postgresql PG.Connection @@ -148,12 +153,24 @@ -> m (Pool Postgresql) createPostgresqlPool s connCount = liftIO $ createPool (open' s) close' 1 20 connCount +-- Not sure of the best way to handle Semigroup/Monoid changes in ghc 8.4+-- here. It appears that the long SQL query text interferes with the use+-- of CPP here.+--+-- Manually copying over https://github.com/lpsmith/postgresql-simple/commit/44c0bb8dec3b71e8daefe104cf643c0c4fb26768#diff-75d19972de474bc8fa181e4733f3f0d6R94+-- but this is not really a good idea.+--+combine :: PG.Query -> PG.Query -> PG.Query+-- combine = (<>)+combine (PG.Query a) (PG.Query b) = PG.Query (B.append a b)++ instance Savepoint Postgresql where withConnSavepoint name m (Postgresql c) = do let name' = fromString name- liftIO $ PG.execute_ c $ "SAVEPOINT " <> name'- x <- onException m (liftIO $ PG.execute_ c $ "ROLLBACK TO SAVEPOINT " <> name')- liftIO $ PG.execute_ c $ "RELEASE SAVEPOINT" <> name'+ liftIO $ PG.execute_ c $ "SAVEPOINT " `combine` name'+ x <- onException m (liftIO $ PG.execute_ c $ "ROLLBACK TO SAVEPOINT " `combine` name')+ liftIO $ PG.execute_ c $ "RELEASE SAVEPOINT" `combine` name' return x instance ConnectionManager Postgresql where
Database/Groundhog/Postgresql/Array.hs view
@@ -40,7 +40,7 @@ import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString as B import qualified Data.ByteString.Unsafe as B -import Data.Monoid +import Data.Monoid hiding ((<>)) import Data.Word import qualified Data.Vector as V import Data.Traversable (traverse)
changelog view
@@ -1,3 +1,6 @@+0.9.0+* Support for GHC 8.4+ 0.8.0.3 * New typeclass to allow transaction rollback through ExceptT
groundhog-postgresql.cabal view
@@ -1,5 +1,5 @@ name: groundhog-postgresql-version: 0.8.0.3+version: 0.9.0 license: BSD3 license-file: LICENSE author: Boris Lykah <lykahb@gmail.com>@@ -22,7 +22,7 @@ , bytestring >= 0.9 , blaze-builder >= 0.3 && < 0.5 , transformers >= 0.2.1 && < 0.6- , groundhog >= 0.8.0.1 && < 0.9+ , groundhog >= 0.9.0 && < 0.10 , monad-control >= 0.3 && < 1.1 , containers >= 0.2 , text >= 0.8@@ -32,6 +32,11 @@ , time >= 1.1 , vector >= 0.10 && < 0.13 , resourcet >= 1.1.2++ -- See https://prime.haskell.org/wiki/Libraries/Proposals/SemigroupMonoid#Writingcompatiblecode+ if !impl(ghc >= 8.0)+ build-depends: semigroups+ exposed-modules: Database.Groundhog.Postgresql Database.Groundhog.Postgresql.Array Database.Groundhog.Postgresql.Geometry