generated from tpl/purs
Rename connection
to client
property in ConnectResult
This commit is contained in:
parent
7e03b445a6
commit
631fef38f8
@ -20,7 +20,7 @@ exports.ffiConnect = function (config) {
|
|||||||
return function (onError, onSuccess) {
|
return function (onError, onSuccess) {
|
||||||
var p = pool.connect().then(function(client) {
|
var p = pool.connect().then(function(client) {
|
||||||
onSuccess(config.right({
|
onSuccess(config.right({
|
||||||
connection: client,
|
client: client,
|
||||||
done: function() {
|
done: function() {
|
||||||
return client.release();
|
return client.release();
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import Prelude
|
|||||||
import Control.Monad.Error.Class (catchError, throwError)
|
import Control.Monad.Error.Class (catchError, throwError)
|
||||||
import Data.Array (head)
|
import Data.Array (head)
|
||||||
import Data.Bifunctor (lmap)
|
import Data.Bifunctor (lmap)
|
||||||
import Data.Either (Either(..), either, hush)
|
import Data.Either (Either(..), either)
|
||||||
import Data.Generic.Rep (class Generic)
|
import Data.Generic.Rep (class Generic)
|
||||||
import Data.Generic.Rep.Show (genericShow)
|
import Data.Generic.Rep.Show (genericShow)
|
||||||
import Data.Maybe (Maybe(..), maybe)
|
import Data.Maybe (Maybe(..), maybe)
|
||||||
@ -70,7 +70,7 @@ withClient p k = bracket (connect p) cleanup run
|
|||||||
|
|
||||||
run (Left err) = k (Left err)
|
run (Left err) = k (Left err)
|
||||||
|
|
||||||
run (Right { connection }) = k (Right connection)
|
run (Right { client }) = k (Right client)
|
||||||
|
|
||||||
-- | Trivial helper / shortcut which also wraps
|
-- | Trivial helper / shortcut which also wraps
|
||||||
-- | the connection to provide `Connection`.
|
-- | the connection to provide `Connection`.
|
||||||
@ -92,7 +92,7 @@ connect =
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ConnectResult
|
type ConnectResult
|
||||||
= { connection :: Client
|
= { client :: Client
|
||||||
, done :: Effect Unit
|
, done :: Effect Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ execute ::
|
|||||||
Query i o ->
|
Query i o ->
|
||||||
i ->
|
i ->
|
||||||
Aff (Maybe PGError)
|
Aff (Maybe PGError)
|
||||||
execute conn (Query sql) values = hush <<< either Right Left <$> unsafeQuery conn sql (toSQLRow values)
|
execute conn (Query sql) values = either Just (const $ Nothing) <$> unsafeQuery conn sql (toSQLRow values)
|
||||||
|
|
||||||
-- | Execute a PostgreSQL query and return its results.
|
-- | Execute a PostgreSQL query and return its results.
|
||||||
query ::
|
query ::
|
||||||
|
Loading…
Reference in New Issue
Block a user