Update pg.connect with pool.connect (#2822)

pg.connect() has been deprecated.
This commit is contained in:
Yue Dai 2022-09-27 03:31:07 -07:00 committed by GitHub
parent 9a95ee719b
commit 9e2d7c4ad5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,11 +15,12 @@ _requires pg>=2.8.1_
```js
const pg = require('pg')
var pool = new pg.Pool()
const QueryStream = require('pg-query-stream')
const JSONStream = require('JSONStream')
//pipe 1,000,000 rows to stdout without blowing up your memory usage
pg.connect((err, client, done) => {
pool.connect((err, client, done) => {
if (err) throw err
const query = new QueryStream('SELECT * FROM generate_series(0, $1) num', [1000000])
const stream = client.query(query)