1.0.3 • Published 5 years ago

pg-named v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

pg-named

Named parameters for node-postgres. Kudos to: https://github.com/bwestergard/node-postgres-named and the refactored https://github.com/jars/node-postgres-named.

Before:

client.query('SELECT name FROM person WHERE name = $1 AND tenure <= $2 AND age <= $3', ['Ursus', 2.5, 24]).then(console.log);

After:

client.query('SELECT name FROM person WHERE name = :name AND tenure <= :tenure AND age <= :age', {'name': 'Ursus', 'tenure': 2.5, 'age': 24}).then(console.log);

Placeholders must begin with : or $ and can contain only alphanumerics, underscores, and dashes.

Usage

import pg from 'pg';
import pgNamed from 'pg-named';

pgNamed(pg);
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago