A JavaScript/TypeScript template literal tag that formats SQL queries into {text, values} objects compatible with node-postgres. Version 2.4.1 is the current stable release. This is a fork of @sequencework/sql that adds global support by fixing `instanceof` behavior across multiple `require` calls via a type tag. Key differentiators: lightweight (~50 lines), 100% test coverage, supports nested tags and conditional expressions, and includes helpers like `sql.raw` for unescaped values. Released infrequently, primarily bug fixes.
npm install sequencework-sql-globalNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage with node-postgres: template literal with parameters, async query execution.
Use `condition ? sql\`...\` : undefined` instead of `condition && sql\`...\``.
Never pass unsanitized user input to `sql.raw`. Validate or use parameterized queries.
Upgrade to version 2.x (this fork) or ensure only one version is installed.
Use the result directly with `pg.query()` or similar. Do not combine sql-tagged literals manually.
Use `sql\`...\`` (template literal tag) without `new`.
Use `import sql from 'sequencework-sql-global'` or `const sql = require('sequencework-sql-global')`.Use `import sql from 'sequencework-sql-global'` in ES modules, or use `const { default: sql } = require('sequencework-sql-global')` for CommonJS interop.