https://github.com/btd/simple-pg
Utilities to work with postgresql
https://github.com/btd/simple-pg
Last synced: 8 months ago
JSON representation
Utilities to work with postgresql
- Host: GitHub
- URL: https://github.com/btd/simple-pg
- Owner: btd
- License: mit
- Created: 2019-07-06T09:55:06.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-12T09:07:12.000Z (over 4 years ago)
- Last Synced: 2025-02-28T07:44:48.409Z (over 1 year ago)
- Language: JavaScript
- Size: 79.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ingo-pg
Small wrapper around `node-pg` including patched `node-pg-query-stream` to make it work with node v11.
It contains set of patches to fix int8 to integer conversion.
To use:
```js
const { db } = require('ingo-pg');
db.initPool({ /* node-pg pool options */ });
const result = await db.run('select 1');
```
It has safe query builder:
```js
const { sql } = require('ingo-pg');
const id = 1;
const q = sql`select col from tbl where id = ${id}`;
db.run(q);
```
It has helpers for update and insert statements, use `updateSet`,
`values`,
`insert` functions exported from `ingo-pg`.