pg-sql
JSON →A safe and composable SQL string builder for Postgres using template strings. Current stable version: 1.1.0. The library exposes a `sql` template tag and helper functions (`sql.ident`, `sql.raw`, `sql.join`) that produce `{ text, values }` objects compatible with the `pg` npm package. It prevents SQL injection by treating all interpolated values as parameters unless explicitly escaped via `sql.ident` or `sql.raw`. Unlike ORMs or raw query building, `pg-sql` keeps full control of SQL while ensuring safety and composability. It is released on an as-needed basis and ships TypeScript definitions.
Resources
packagepg-sql ↗