pg-require-sql

1.0.0 • Public • Published

pg-require-sql

js-standard-style Circle CI Dependency Status

'Require' sql files for use with pg-connect.

Installation

npm install --save pg-require-sql

Usage

Given a project like

|- index.js
|- sql-directory
  |- get-record.sql

the following will query

var Promise = require('bluebird')
var path = require('path')
var getConnection = require('pg-connect')(connectionString)
var requireSql = require('pg-require-sql')
 
var sql = requireSql(path.join(__dirname, 'sql-directory'))
 
Promise.using(
  getConnection(),
  sql.getRecord(['foo'])
).
then(function (results) {
  // ... use the results
})

Readme

Keywords

Package Sidebar

Install

npm i pg-require-sql

Weekly Downloads

8

Version

1.0.0

License

MIT

Last publish

Collaborators

  • lanetix-system
  • jyothis-qb
  • manu-kodiyan-winmore
  • dnm-winmore
  • mkdyanugk
  • vigneshk7
  • aswanth
  • sajith.qb
  • dhiluraj-qburst
  • cdrohithmqb
  • arjunqb
  • dheerajds
  • renjith_ram_qburst
  • sidharth.n
  • rahulbharadwaj
  • jasif-wm
  • sharmarakesh
  • arpit1024
  • showvhick-winmore
  • divyansh-winmore
  • apechimp