mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-12-26 20:12:09 +03:00
Merge pull request #55 from cocreature/libpq-access
Expose access to raw libpq connection
This commit is contained in:
commit
4542b52282
@ -8,6 +8,7 @@ module Hasql.Connection
|
||||
release,
|
||||
Settings,
|
||||
settings,
|
||||
withLibPQConnection
|
||||
)
|
||||
where
|
||||
|
||||
|
@ -42,3 +42,9 @@ release (Connection pqConnectionRef _ _) =
|
||||
nullConnection <- LibPQ.newNullConnection
|
||||
pqConnection <- swapMVar pqConnectionRef nullConnection
|
||||
IO.releaseConnection pqConnection
|
||||
|
||||
-- | Execute an operation on the raw @libpq@ 'LibPQ.Connection'.
|
||||
--
|
||||
-- The access to the connection is exclusive.
|
||||
withLibPQConnection :: Connection -> (LibPQ.Connection -> IO a) -> IO a
|
||||
withLibPQConnection (Connection pqConnectionRef _ _) = withMVar pqConnectionRef
|
||||
|
Loading…
Reference in New Issue
Block a user