|
|
|
|
|
by jameslk
2831 days ago
|
|
It's a nice feature, when used for template strings. Looking at the library, it just looks awkward: sq.from`book`
.return`distinct author`
.where({ genre: 'Fantasy' })
.where({ language: 'French' })
I can already hear the questions:"Why do some functions require parenthesis and some don't?"
"When do I need to use parenthesis?" It's just unnecessarily confusing. |
|
In this specific example, let's say you have:
You don't want a sql injection to occur if somehow `field = 'author'; drop table book; --` or similar.With a plain function call, the library would have no way of knowing what to sanitize.
And without template tags, the API would arguably look more complex, and require the user to discover/learn an ad-hoc interpolation DSL: You can still target the template tag's raw API requirements without the syntax (though you'd lose readability with multiple interpolations):