1.4.2 • Published 6 years ago

jeeng-pg v1.4.2

Weekly downloads
3
License
ISC
Repository
-
Last release
6 years ago

jeeng-pg

A helper function to handle frequent postgres operations. Using 'node-postgres' package underneath the hood. Better suited for serverless functions

install

npm install --save jeeng-pg

Usage

  1. Import package:
const { DB } = require('jeeng-pg')
  1. Create a new db instance:
const db = new DB(<CONNECTION STRING>)
  1. Create the queries class:
const { GenericQueries } = require('jeeng-pg')

export const Queries extends GenericQueries {
    sampleQuery() {
        const q = 'SELECT 1 AS test_value'
        return this.DB.resolveQuery(q, ({rows}) => rows.length & rows[0].test_value)
    }
}
  1. Instiantiate queries class and execute:
const queries = new Queries(DB)
queries.sampleQuery()
    .then(...)
    .catch(...)
1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago