o2sql-pg is a ready-to-use tool to have o2sql (a SQL query builder) working with pg (node-postgres). It provides an O2sqlPg factory that creates an o2sql instance configured with a PostgreSQL connection pool. It supports building and executing SELECT/INSERT/UPDATE/DELETE queries using the o2sql fluent API, with support for nested group columns, transactions, and direct pg queries. Current stable version is 1.0.11. It wraps the o2sql and pg libraries, offering a convenient integration layer. Key differentiator: combines o2sql's query builder with pg's connection management, handling pool creation internally for simplicity.
npm install o2sql-pgNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an o2sql instance with pg pool config, runs a simple select query, and prints results.
Simply call o2sqlPg(config) without new.
Always pass the client: await o2sql.select(...).execute(client);
Use o2sql.select(...).execute() instead of o2sql.query().
Install @types/pg and check for community type definitions for o2sql.
Use: import o2sqlPg from 'o2sql-pg'; (no curly braces)
const o2sql = o2sqlPg({...}); then use o2sql.select(...)In transactions, the client is provided by the library; do not manually connect/disconnect inside the callback.