Question: Named Parameter Syntax
Created by: bighappyworld
Love the library!
I wanted to understand the reason behind the named parameter syntax. Here's an example from the docs:
db.query(
'select * from tests where id > ${something}',
{something: 1}
).then(tests => {
// all tests matching the criteria
});
It is using the same javascript syntax for variable replacement in a back ticked string. So it actually prevents someone from being able to use a back ticked string when building the query sql. And I think normal linter rules look for this and pop a warning that there is a string substitution detected but the wrong type of quotes (possibly even auto-fixing it incorrectly). A poor example would be substituting the table name tests for a variable table name.
I just wondered the reasoning behind using the same syntax and if there was any "advantage" in using it that I wasn't seeing. Thanks!