pg-cli is a small library wrapping node-pg (pg) to provide a more user-friendly PostgreSQL client for Node.js. It offers callback, thunk, and promise API styles, supports multiple database connection pools, and enables single- and multi-database transactions. Version 2.0.1 is stable, with a release cadence of approximately one year. It differentiates from raw pg by providing simplified CRUD operations like select, insert, update, updateBatch, and JSONB support, reducing boilerplate for common PostgreSQL tasks.
npm install pg-cliNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize a PostgreSQL pool and run a simple SELECT query using pg-cli.
Ensure table names in select/insert/update match the database exactly.
Always pass an array (even empty) as second argument to select.
Wrap callbacks in Promises manually or use a promisify utility.
Use const { jsonbSet } = require('pg-cli');Always verify the matching column name matches the where condition exactly.
Run 'npm install pg' in your project.
Use 'const pgHelper = require("pg-cli");' instead of import.Use exact table name as defined in database (e.g., 'User' vs 'users').