const Cursor = require('async-iterator-pg-cursor');
const pg = require('pg');
const host = process.env.DATABASE_HOST;
const user = process.env.DATABASE_USER;
const port = process.env.DATABASE_PORT;
const password = process.env.DATABASE_PASSWORD;
const database = process.env.DATABASE_NAME;
const client = new pg.Client({ database, host, port, user, password });
const query = `SELECT * FROM products`;
async function start() {
await client.connect();
const cursor = new Cursor(client, query);
for await (const rows of cursor) {
for (const row of rows) {
console.log(row);
}
}
return true;
};
start().then(() => process.exit());
This repository has been archived by the owner on Oct 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
License
ordermentum/async-iterator-pg-cursor
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published