new PgConnection()
A connection to Postgres.
- Source:
Methods
cancelRequest(handler) → {PgConnection}
Send a request cancellation message to tell the server to cancel processing request in this connection.
Note: Use this with caution because the cancellation signal may or may not have any effect.
Parameters:
| Name |
Type |
Description |
handler |
function
|
the handler notified if cancelling request is sent |
- Source:
Returns:
a reference to this, so the API can be used fluently
-
Type
-
PgConnection
closeHandler(handler) → {PgConnection}
Parameters:
| Name |
Type |
Description |
handler |
function
|
|
- Source:
Returns:
-
Type
-
PgConnection
exceptionHandler(handler) → {PgConnection}
Parameters:
| Name |
Type |
Description |
handler |
function
|
|
- Source:
Returns:
-
Type
-
PgConnection
notificationHandler(handler) → {PgConnection}
Set an handler called when the connection receives notification on a channel.
The handler is called with the
PgNotification and has access to the channel name
and the notification payload.
Parameters:
| Name |
Type |
Description |
handler |
function
|
the handler |
- Source:
Returns:
the transaction instance
-
Type
-
PgConnection
prepare(sql, handler) → {PgConnection}
Parameters:
| Name |
Type |
Description |
sql |
string
|
|
handler |
function
|
|
- Source:
Returns:
-
Type
-
PgConnection
preparedBatch(sql, batch, handler) → {PgConnection}
Parameters:
| Name |
Type |
Description |
sql |
string
|
|
batch |
Array.<Tuple>
|
|
handler |
function
|
|
- Source:
Returns:
-
Type
-
PgConnection
preparedQuery(sql, arguments, handler) → {PgConnection}
Parameters:
| Name |
Type |
Description |
sql |
string
|
|
arguments |
Tuple
|
|
handler |
function
|
|
- Source:
Returns:
-
Type
-
PgConnection
processId() → {number}
- Source:
Returns:
The process ID of the target backend
-
Type
-
number
query(sql, handler) → {PgConnection}
Parameters:
| Name |
Type |
Description |
sql |
string
|
|
handler |
function
|
|
- Source:
Returns:
-
Type
-
PgConnection
secretKey() → {number}
- Source:
Returns:
The secret key for the target backend
-
Type
-
number