packages feed

hpqtypes 1.10.0.2 → 1.11.0.0

raw patch · 4 files changed

+16/−22 lines, 4 filesdep ~resource-poolPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: resource-pool

API changes (from Hackage documentation)

- Database.PostgreSQL.PQTypes: poolSource :: ConnectionSettings -> Double -> Int -> IO (ConnectionSource [MonadBase IO, MonadMask])
+ Database.PostgreSQL.PQTypes: poolSource :: ConnectionSettings -> (IO Connection -> (Connection -> IO ()) -> PoolConfig Connection) -> IO (ConnectionSource [MonadBase IO, MonadMask])
- Database.PostgreSQL.PQTypes.Internal.Connection: poolSource :: ConnectionSettings -> Double -> Int -> IO (ConnectionSource [MonadBase IO, MonadMask])
+ Database.PostgreSQL.PQTypes.Internal.Connection: poolSource :: ConnectionSettings -> (IO Connection -> (Connection -> IO ()) -> PoolConfig Connection) -> IO (ConnectionSource [MonadBase IO, MonadMask])

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# hpqtypes-1.11.0.0 (2023-01-18)+* Require `resource-pool` >= 0.4 and adjust the `createPool` function to+  seamlessly accommodate future changes to the `resource-pool` library.+ # hpqtypes-1.10.0.2 (2022-10-12) * Simplify Setup. 
hpqtypes.cabal view
@@ -1,5 +1,5 @@ name:                hpqtypes-version:             1.10.0.2+version:             1.11.0.0 synopsis:            Haskell bindings to libpqtypes  description:         Efficient and easy-to-use bindings to (slightly modified)@@ -104,7 +104,7 @@                      , transformers-base >= 0.4                      , monad-control     >= 1.0.3                      , lifted-base       >= 0.2-                     , resource-pool     >= 0.3+                     , resource-pool     >= 0.4                      , mtl               >= 2.1                      , transformers      >= 0.2.2                      , containers        >= 0.5.0.0@@ -189,6 +189,7 @@                      , monad-control >= 1.0.3                      , mtl >= 2.1                      , random >= 1.0+                     , resource-pool                      , scientific                      , test-framework >= 0.8                      , test-framework-hunit >= 0.3
src/Database/PostgreSQL/PQTypes/Internal/Connection.hs view
@@ -137,27 +137,14 @@ -- established connections and reuse them. poolSource   :: ConnectionSettings-  -> Double-  -- ^ The amount of seconds for which an unused database connection is kept-  -- open. The smallest acceptable value is 0.5 seconds.-  ---  -- /Note:/ the elapsed time before closing database connection may be a little-  -- longer than requested, as the reaper thread wakes at 1-second intervals.-  -> Int-  -- ^ The maximum number of database connections to keep open.+  -> (IO Connection -> (Connection -> IO ()) -> PoolConfig Connection)+  -- ^ A function for creating the 'PoolConfig' with desired parameters.   ---  -- /Note:/ for each stripe the number of resources is divided by the number of-  -- capabilities and rounded up. Therefore the pool might end up creating up to-  -- @N - 1@ resources more in total than specified, where @N@ is the number of-  -- capabilities.+  -- /Note:/ supplied arguments are for creation and destruction of a database+  -- connection.   -> IO (ConnectionSource [MonadBase IO, MonadMask])-poolSource cs idleTime maxResources = do-  pool <- newPool PoolConfig-    { createResource = connect cs-    , freeResource = disconnect-    , poolCacheTTL = idleTime-    , poolMaxResources = maxResources-    }+poolSource cs mkPoolConfig = do+  pool <- newPool $ mkPoolConfig (connect cs) disconnect   return $ ConnectionSource $ ConnectionSourceM {     withConnection = doWithConnection pool . (clearStats >=>)   }
test/Main.hs view
@@ -12,6 +12,7 @@ import Data.Char import Data.Int import Data.Maybe+import Data.Pool import Data.Time import Data.Typeable import Data.Word@@ -660,7 +661,8 @@    createStructures connSource   ConnectionSource connPool <--    poolSource (connSettings { csComposites = ["simple_", "nested_"] }) 30 16+    poolSource (connSettings { csComposites = ["simple_", "nested_"] })+               (\create destroy -> defaultPoolConfig create destroy 30 16)   gen <- newQCGen   putStrLn $ "PRNG:" <+> show gen