A lightweight JavaScript query builder for PostgreSQL that constructs raw SQL queries programmatically. Version 1.3.7 is current, with a dependency on the 'pg' package added in 1.3.5 allowing direct database queries from Express routes. It supports SELECT, FROM, JOIN, WHERE, UPDATE, and spatial functions (ST_Transform, ST_GeomFromText). Distinctive for its minimal API and optional direct query execution via connection string, but lacks TypeScript types and modern ESM support. Suitable for small projects needing simple SQL generation without an ORM.
npm install tougo-query-builderNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic query building and spatial function usage with tougo-query-builder.
npm install pg
Always access .query without parentheses: builder.select(...).query;
var qsp = new qb.spatial(); qsp.Transform(...);
Use require() or switch to an ESM-compatible query builder.
npm install tougo-query-builder
var qsp = new qb.spatial();
var instance = new (require('tougo-query-builder'))();