README update; withConnection and withTransaction flipped parameter

This commit is contained in:
Kamirus
2019-08-30 12:15:05 +02:00
parent 4f89eadfbc
commit 6ce8b99ecd
3 changed files with 27 additions and 17 deletions

View File

@@ -5,7 +5,7 @@ module Test.Main
import Prelude
import Control.Monad.Error.Class (throwError, try)
import Control.Monad.Except.Trans (ExceptT, runExceptT)
import Control.Monad.Except.Trans (runExceptT)
import Control.Monad.Trans.Class (lift)
import Data.Array (zip)
import Data.Date (Date, canonicalDate)
@@ -21,7 +21,6 @@ import Data.Newtype (unwrap)
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Database.PostgreSQL.PG (Connection, PGError(..), Pool, PoolConfiguration, Query(Query), Row0(Row0), Row1(Row1), Row2(Row2), Row3(Row3), Row9(Row9), command, execute, newPool, onIntegrityError, query, scalar)
import Database.PostgreSQL.PG as PG
import Effect (Effect)
import Effect.Aff (Aff, error, launchAff)
import Effect.Class (liftEffect)
@@ -31,18 +30,19 @@ import Global.Unsafe (unsafeStringify)
import Math ((%))
import Partial.Unsafe (unsafePartial)
import Test.Assert (assert)
import Test.README (run, PG, withConnection, withTransaction) as README
import Test.Unit (TestSuite, suite)
import Test.Unit as Test.Unit
import Test.Unit.Assert (equal)
import Test.Unit.Main (runTest)
type PG a = ExceptT PGError Aff a
type PG a = README.PG a
withConnection :: forall a. Pool -> (Connection -> PG a) -> PG a
withConnection conn = PG.withConnection conn runExceptT
withConnection = README.withConnection
withTransaction :: forall a. Connection -> PG a -> PG a
withTransaction conn = PG.withTransaction conn runExceptT
withTransaction = README.withTransaction
pgEqual :: forall a. Eq a => Show a => a -> a -> PG Unit
pgEqual a b = lift $ equal a b