jeeng-redis
v1.4.0
Published
A native promise based helper class to work with redis databases
Downloads
4
Maintainers
Readme
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
- Import package:
const { DB } = require('jeeng-pg')
- Create a new
db
instance:
const db = new DB(<CONNECTION STRING>)
- 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)
}
}
- Instiantiate queries class and execute:
const queries = new Queries(DB)
queries.sampleQuery()
.then(...)
.catch(...)