mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
Fix example code for connect event (#14)
This commit is contained in:
parent
baa5800a70
commit
d316ef5524
@ -207,8 +207,8 @@ Fired whenever the pool creates a __new__ `pg.Client` instance and successfully
|
||||
Example:
|
||||
|
||||
```js
|
||||
var pg = require('pg')
|
||||
var pool = new pg.Pool()
|
||||
const Pool = require('pg-pool')
|
||||
const pool = new Pool()
|
||||
|
||||
var count = 0
|
||||
|
||||
@ -220,10 +220,10 @@ pool
|
||||
.connect()
|
||||
.then(client => {
|
||||
return client
|
||||
.query('SELECT $1::int AS "clientCount', [client.count])
|
||||
.query('SELECT $1::int AS "clientCount"', [client.count])
|
||||
.then(res => console.log(res.rows[0].clientCount)) // outputs 0
|
||||
.then(() => client)
|
||||
}))
|
||||
})
|
||||
.then(client => client.release())
|
||||
|
||||
```
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user