pg-cr-layer (v2.0.26) is a lightweight PostgreSQL interface layer that wraps the popular pg library with ES2015 promises and provides a simplified API for common database operations like queries, transactions, and stored procedures. It is designed to be compatible with mssql-cr-layer for easy switching between PostgreSQL and MSSQL. The package offers a pool configuration and parameterized queries with positional ($1, $2) and named (@param) placeholders, though it has not been updated since 2019 and lacks TypeScript definitions.
npm install pg-cr-layerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic CRUD: connect, create table, insert with parameterized query, and close connection.
Consider using modern alternatives like pg-promise, slonik, or the pg library directly.
Prefer positional parameters ($1, $2) for stability.
Use require() instead of import.
Handle errors with try-catch; check for empty arrays.
Use const PgCrLayer = require('pg-cr-layer');Ensure pool sub-object contains valid pg.Pool options like max and idleTimeoutMillis.
Use positional parameters ($1, $2) instead or provide a type object like { param: { value: 1, type: 'integer' } }.