File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ module Database.PostgreSQL.Simple
7373 , Base. connectPostgreSQL
7474 , Base. close
7575 , Base. connect
76+ , Base. withConnect
7677 , Base. ConnectInfo (.. )
7778 , Base. defaultConnectInfo
7879 , Base. postgreSQLConnectionString
Original file line number Diff line number Diff line change @@ -155,6 +155,10 @@ defaultConnectInfo = ConnectInfo {
155155connect :: ConnectInfo -> IO Connection
156156connect = connectPostgreSQL . postgreSQLConnectionString
157157
158+ -- | Memory bracket around 'connect' and 'close'.
159+ withConnect :: ConnectInfo -> (Connection -> IO c ) -> IO c
160+ withConnect connInfo = bracket (connect connInfo) close
161+
158162-- | Attempt to make a connection based on a libpq connection string.
159163-- See <https://www.postgresql.org/docs/9.5/static/libpq-connect.html#LIBPQ-CONNSTRING>
160164-- for more information. Also note that environment variables also affect
You can’t perform that action at this time.
0 commit comments