Closed bighappyworld closed 5 years ago
Nevermind, I found the reason. It comes from pg-promise. But pg-promise supports a variety of different syntaxes for Named Parameter substitution and they work (just tested). Updating the docs on Massive to say it supports the ones from pg-promise would be helpful because the current docs make it look like the above syntax is the only syntax (at least to me).
Added to the docs: https://github.com/dmfay/massive-js/pull/669
Love the library!
I wanted to understand the reason behind the named parameter syntax. Here's an example from the docs:
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!