persistent-postgresql 2.13.4.1 → 2.13.5.0
raw patch · 3 files changed
+40/−2 lines, 3 files
Files
- ChangeLog.md +5/−0
- Database/Persist/Postgresql.hs +34/−1
- persistent-postgresql.cabal +1/−1
ChangeLog.md view
@@ -1,5 +1,10 @@ # Changelog for persistent-postgresql +## 2.13.5.0++* [#1362](https://github.com/yesodweb/persistent/pull/1362/)+ * Define `withPostgresqlPoolModifiedWithVersion`+ ## 2.13.4.1 * [#1367](https://github.com/yesodweb/persistent/pull/1367),
Database/Persist/Postgresql.hs view
@@ -26,9 +26,14 @@ module Database.Persist.Postgresql ( withPostgresqlPool , withPostgresqlPoolWithVersion+ , withPostgresqlPoolWithConf++ , withPostgresqlPoolModified+ , withPostgresqlPoolModifiedWithVersion+ , withPostgresqlConn , withPostgresqlConnWithVersion- , withPostgresqlPoolWithConf+ , createPostgresqlPool , createPostgresqlPoolModified , createPostgresqlPoolModifiedWithVersion@@ -194,6 +199,34 @@ modConn = pgConfHooksAfterCreate hooks let logFuncToBackend = open' modConn getVer id (pgConnStr conf) withSqlPoolWithConfig logFuncToBackend (postgresConfToConnectionPoolConfig conf)++-- | Same as 'withPostgresqlPool', but with the 'createPostgresqlPoolModified'+-- feature.+--+-- @since 2.13.5.0+withPostgresqlPoolModified+ :: (MonadUnliftIO m, MonadLoggerIO m)+ => (PG.Connection -> IO ()) -- ^ Action to perform after connection is created.+ -> ConnectionString -- ^ Connection string to the database.+ -> Int -- ^ Number of connections to be kept open in the pool.+ -> (Pool SqlBackend -> m t)+ -> m t+withPostgresqlPoolModified = withPostgresqlPoolModifiedWithVersion getServerVersion++-- | Same as 'withPostgresqlPool', but with the+-- 'createPostgresqlPoolModifiedWithVersion' feature.+--+-- @since 2.13.5.0+withPostgresqlPoolModifiedWithVersion+ :: (MonadUnliftIO m, MonadLoggerIO m)+ => (PG.Connection -> IO (Maybe Double)) -- ^ Action to perform to get the server version.+ -> (PG.Connection -> IO ()) -- ^ Action to perform after connection is created.+ -> ConnectionString -- ^ Connection string to the database.+ -> Int -- ^ Number of connections to be kept open in the pool.+ -> (Pool SqlBackend -> m t)+ -> m t+withPostgresqlPoolModifiedWithVersion getVerDouble modConn ci = do+ withSqlPool (open' modConn (oldGetVersionToNew getVerDouble) id ci) -- | Create a PostgreSQL connection pool. Note that it's your -- responsibility to properly close the connection pool when
persistent-postgresql.cabal view
@@ -1,5 +1,5 @@ name: persistent-postgresql-version: 2.13.4.1+version: 2.13.5.0 license: MIT license-file: LICENSE author: Felipe Lessa, Michael Snoyman <michael@snoyman.com>