-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL Template Strings #15
Comments
I currently would like to do a bit in this area. Several things I'd like to "solve" ( some only in the macro variant ) about bind parameters.
The next step is to figure out an ergonomic method for batch insertions.. |
Are only the positional "?" parameters supported at this point? Ah, sorry I did not see the following issue: |
I'm going to close this for now. We've since decided to not implicitly touch the query string. So unfortunately stuff like I mentioned in the above comment isn't directly possible. We feel that placeholder ( With that said, we are planning on adding a low-level dynamic query builder in the near future that would allow this. I do want to explore query builders at some future but that's not on even our long-term roadmap which is why I'm closing this issue. I do still like the idea expressed in the opening. I feel it might be cool for someone to do a Maud ( https://maud.lambda.xyz/ ) style DSL using SQLx which can do stuff like that. |
* Add support for full Unicode character set * Add server tests for unicode support
One of my favorite libraries from the node world is
sql-template-strings
. It allows users to take something like this:And instead write this:
Notice the placement of the
book
andauthor
variables -- they are placed inline inside the query.sql-template-strings
handles creating a prepared statement and ordering the parameters for query execution.sqlx
reminds me a lot of the first snippet, with the primary additional benefit being that we can get type-safety inferred from the query (which on its own is very cool!). I don't know a lot about Rust macros, but I was wondering if it would be possible to take thesqlx
macro a step further and additionally implementsql-template-strings
-style inline parameters.Edit:
Here's another example from the
sql-template-strings
README showing the benefit when a lot of parameters are used:The text was updated successfully, but these errors were encountered: