plywood-postgres-requester
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

plywood-postgres-requester

This is the Postgres requester making abstraction layer for plywood.

Given a Postgres query and an optional context it return a Q promise that resolves to the data table.

Installation

To install run:

npm install plywood-postgres-requester

Usage

In the raw you could use this library like so:

postgresRequesterGenerator = require('plywood-postgres-requester').postgresRequester

postgresRequester = postgresRequesterGenerator({
  host: 'my.postgres.host',
  database: 'all_my_data',
  user: 'HeMan',
  password: 'By_the_Power_of_Greyskull'
})

postgresRequester({
  query: 'SELECT "cut" AS "Cut", sum("price") AS "TotalPrice" FROM "diamonds" GROUP BY "cut";'
})
  .then(function(res) {
    console.log("The first row is:", res[0])
  })
  .done()

Although usually you would just pass postgresRequester into the Postgres driver that is part of Plywood.

Tests

Currently the tests run against a real Postgres database that should be configured (database, user, password) the same as what is indicated in test/info.coffee.

/plywood-postgres-requester/

    Package Sidebar

    Install

    npm i plywood-postgres-requester

    Weekly Downloads

    622

    Version

    1.4.0

    License

    Apache-2.0

    Unpacked Size

    16 kB

    Total Files

    6

    Last publish

    Collaborators

    • lorem--ipsum
    • vadimon