A JavaScript library (v1.0.0-32, prerelease) for managing SQL queries using ES6 tagged template literals. It provides a template system to keep queries readable, maintainable, reusable, and organized, while allowing syntax adaptation across different database engines (PostgreSQL, MySQL, etc.). Unlike ORMs, it focuses solely on template management. It can be used as a Node.js module or as a CLI tool for generating SQL from templates. The library supports advanced features like parameterized arguments, conditional blocks, includes, comments, and multiple engine dialects. Its key differentiator is leveraging tagged templates for inline SQL composition without external template files, and the ability to publish templates for CLI execution.
npm install sqlttNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Show how to define a sqltt template with an argument, generate SQL for PostgreSQL and MySQL, and publish for CLI use.
Use double dollar sign $$ for literal dollar signs in SQL.
Inside the function, use $ to call the template literal and to access helper methods (e.g., $.include).
Update to v1.0.0-32 and use: sqltt.publish(module, tpl) where tpl is an object with template names as keys.
Use the SQL string with your database client (e.g., pool.query(sqlttRes.sql(params))).
Explicitly specify engine: 'postgresql', 'mysql', etc. when calling .sql() to get correct placeholders.
Use 'const sqltt = require('sqltt')' for CommonJS, or ensure ESM and use 'new sqltt(...)'.Ensure you import sqltt correctly: const sqltt = require('sqltt');Check your template string: new sqltt($=>$`...`) with closing backtick and parentheses.
No dependency data recorded yet.