Registry / database / jeeng-pg

jeeng-pg

JSON →
library1.4.2jsnpmunverified

A Node.js helper library (v1.4.2) wrapping 'node-postgres' (pg) to simplify common PostgreSQL operations, optimized for serverless environments. Provides a DB class with built-in connection pooling and query resolution, plus a GenericQueries base class for structured query definitions. Release cadence is low (no recent updates). Key differentiator: minimal abstraction tailored for serverless functions vs. full ORMs like Sequelize or TypeORM.

npm install jeeng-pg
INSTALL
IMPORT
SIG · JEENG-PG
J
jeeng-pg
databasejavascriptv1.4.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DB
import { DB } from 'jeeng-pg'
const DB = require('jeeng-pg').DB
ESM import supported; avoid destructuring require.
GenericQueries
import { GenericQueries } from 'jeeng-pg'
const { GenericQueries } = require('jeeng-pg')
ESM import works; CommonJS require may work but is not recommended.
DB class instantiation
const db = new DB(connectionString)
const db = new DB()
Connection string is mandatory; no default configuration.

Shows ESM import of DB and GenericQueries, custom query class, and query execution with a callback.

import { DB, GenericQueries } from 'jeeng-pg'; class MyQueries extends GenericQueries { getUsers() { const q = 'SELECT * FROM users LIMIT 10'; return this.DB.resolveQuery(q, (result) => result.rows); } } async function main() { const connectionString = process.env.DATABASE_URL ?? ''; const db = new DB(connectionString); const queries = new MyQueries(db); const users = await queries.getUsers(); console.log(users); } main().catch(console.error);
Debug
Known issues
breakingRequires 'pg' installed as a peer dependency; version compatibility: uses pg Pool internally.
fix
Ensure 'pg' is in package.json dependencies.
affects: >=1.0.0
gotcharesolveQuery callback receives raw pg result object; must access .rows or .rowCount explicitly.
fix
Refer to node-postgres docs result format; e.g., (result) => result.rows.
affects: >=1.0.0
gotchaConnection string must be passed to DB constructor; no fallback to environment variables.
fix
Read connection string from process.env and pass explicitly.
affects: >=1.0.0
deprecatedNo TypeScript types included; library is JavaScript only.
fix
Install @types/pg and declare module manually.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'pg'
'pg' peer dependency not installed.
fix
npm install pg
TypeError: this.DB.resolveQuery is not a function
GenericQueries subclass not properly passing db instance.
fix
Ensure constructor calls super(db) and db is an instance of DB.
Error: getaddrinfo ENOTFOUND <host>
Invalid connection string or network issue.
fix
Verify DATABASE_URL includes correct host, port, user, password, database.
Upgrade
Version history
1.4.2latest on npm
Audit
Dependencies
pgrequiredCore PostgreSQL driver; jeeng-pg wraps the pg pool and queries.
Agent activity
7 hits · last 30 days
node
6
Resources
jeeng-pg — npm install jeeng-pg · libregistry