-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Macros don't seem to work with AnyPool #964
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
Comments
Yeah, the macros emit instances of However, we are discussing a way to configure the macros in #916 and #121, and I think this would be a good configuration option to add, something like |
Alternatively we could support a protocol like |
After discussing on Discord, @mehcode and I decided we'll support both options:
|
I didn't expect a response so fast! Thanks a bunch everyone. I look forward to it being in 0.5 😃 |
This is a problem we've known about for a while but weren't quite sure how to address. In the context of other ongoing discussions the |
Hi, I've a follow up question related to this issue. I'm writing a web application which should be able to support multiple database backends, one at a time, defined by the user / admin via a configuration file. I thought Any would be the best way to go on the one hand. On the other hand I like the concept of compile time checks done by the query macros. That's why today I crossed the issue described here. I already experimented with Offline and sqlx-cli. That works like a charm! Anyway I'm wondering if as soon as the query macros allow to use Any I'm good to go or if I rely on a fundamental misunderstanding reaching beyond the ability of query macros to work with Any. Thanks for your support. |
What is the status on this issue? Doesn't seem like it is in the milestone for next major version. |
EDIT: sorry, confused the issue with something else.
|
Is there any status on this? It's been a while. |
Is there any status on this? It's been a while. |
I'd just use the "unsafe" version and skip the macro. That's what I ended up doing, and probably better to do than wait another three years. |
@DarrienG can you show an example? Thanks!
|
Look at the issue I wrote 3 years ago. There's an example that works, and one that throws a compile error. The one that works is the "unsafe" one |
Is this still planned? |
Instantiate yourself an AnyPool (in my case with a Sqlite connection),
Now you have your pool, but it's really an
AnyPool
.Let's give it a query:
The first query behaves as expected. The second one throws a compile error where sqlx seems to be a little too aware of what the AnyPool really is:
I've tried manually getting a connection from the pool, making it a mutable reference, making it not a reference (but also mutable), and it all seems to throw the same compile error. This isn't a problem with the non-macro version of query, so I assume this is a bug.
Supporting info
sqlx version:
The text was updated successfully, but these errors were encountered: