Hacker News new | ask | show | jobs
by janpot 1920 days ago
Last few years I've been using a similar workflow with something like https://www.npmjs.com/package/pg-template-tag in combination with `pg`. I'm never going back to ORMs and query builders.
2 comments

Any reason you chose that over node-sql-template-strings [1], which looks very similar?

[1] https://github.com/felixfbecker/node-sql-template-strings

The template tag solution is cute but dangerous if you can accidentally leave off the `SQL` tag and the query still works.

Ideally the system would require you to use the tag and prohibit a plain ol string.

TypeScript compiler will error on this.
It does require you to use the tag.