Description
Feature Description
The SQL tag is a very handy feature of the new versions, once I've had to simulate earlier through code. I think SQL queries are one of the few ideal cases for using the power of tagged templates.
However, it is lacking a few more utilities to make it handle a broader variety of queries, such as queries that have parts built on conditionals.
The Solution
I would like the solution to be simple and intuitive, as intuitive the current implementation is, without many extra special handling codes/functions. There is already an exception when a function is returned, where the result should be either a string (raw sql) or an array (array parameters). Perhaps if an object of { query: string; parameters: any[] }
is returned then it should be considered as a nested query?
Considered Alternatives
Any other way would require something more concrete, such as creating a specific class NestedSQL
and returning a class instance instead, or adding other functions that return specific forms that can be identified as nested sql.
Additional Context
No response
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqlite-abstract
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, and I know how to start.