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