kyrias / sqlx-conditional-queries

Conditional compile-time verified queries with SQLx
Apache License 2.0
30 stars 4 forks source link

Support for query! #14

Open kimbuba opened 10 months ago

kimbuba commented 10 months ago

Hello! Because of this i cannot use query_as! macro for non trivial queries. Can you please provide support to query! macro as well?

kyrias commented 10 months ago

Hey,

I'd like to, but I'm not sure if there's any way of doing so due to how the query! macro works.

The problem is that each query! invocation results in a Map type containing a unique anonymous row type, and so far I have not been able to come up with a way of providing a reasonable interface over that without SQLx implementing some way of re-using the same row type across invocations.

Zizico2 commented 9 months ago

Is there a way to use conditional_query_as! without returned values? I can't seem to find a way to make it work. Even with a struct Empty; as the row type.

Zizico2 commented 9 months ago

This workaround works with sqlx's query_as!

kyrias commented 8 months ago

Could you attach a minimal reproducible example of something that works with query_as! but not with conditional_query_as!?