pg-template-string

1.0.1 • Public • Published

Simple module allowing you to write postgresql queries from Javascript succinctly.

The template string tag returns a promise of the result set. Example:

 
var people = [
    { name: 'doge' },
    { name: 'Le Lenny' },
    { name: 'Pepe' }
]
 
var personsInDb = `create table person (
    name text
)`.then(() => {
    return Promise.map(people, (person) => `insert into person values(${person.name})`)
})
.then(() => `select * from person`)

Readme

Keywords

none

Package Sidebar

Install

npm i pg-template-string

Weekly Downloads

1

Version

1.0.1

License

ISC

Last publish

Collaborators

  • aghost7