generated from tpl/purs
Improve coding style a bit
This commit is contained in:
parent
6a0f231eb7
commit
f6f3328149
@ -67,7 +67,8 @@ foreign import ffiNewPool
|
||||
. PoolConfiguration
|
||||
-> Eff (postgreSQL :: POSTGRESQL | eff) Pool
|
||||
|
||||
|
||||
-- | Run an action with a connection. The connection is released to the pool
|
||||
-- | when the action returns.
|
||||
withConnection
|
||||
:: ∀ eff a
|
||||
. Pool
|
||||
@ -81,8 +82,6 @@ withConnection p k =
|
||||
|
||||
type PostgreSqlEff eff = (postgreSQL :: POSTGRESQL | eff)
|
||||
|
||||
-- | Run an action with a connection. The connection is released to the pool
|
||||
-- | when the action returns.
|
||||
connect
|
||||
:: ∀ eff
|
||||
. Pool
|
||||
@ -102,7 +101,6 @@ foreign import ffiConnect
|
||||
, done :: Eff (PostgreSqlEff eff) Unit
|
||||
}
|
||||
|
||||
|
||||
-- | Run an action within a transaction. The transaction is committed if the
|
||||
-- | action returns, and rolled back when the action throws. If you want to
|
||||
-- | change the transaction mode, issue a separate `SET TRANSACTION` statement
|
||||
|
@ -16,7 +16,7 @@ import Test.Assert (ASSERT, assert)
|
||||
main :: ∀ eff. Eff (assert :: ASSERT, exception :: EXCEPTION, postgreSQL :: POSTGRESQL | eff) Unit
|
||||
main = void $ launchAff do
|
||||
pool <- newPool config
|
||||
withConnection pool \conn → do
|
||||
withConnection pool \conn -> do
|
||||
execute conn (Query """
|
||||
CREATE TEMPORARY TABLE foods (
|
||||
name text NOT NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user