Use of skip or default with query_as!
macro?
#3074
Unanswered
CalebCurry
asked this question in
Q&A
Replies: 1 comment
-
I'm also running into this issue, I have a hunch that it may have to do with the order in which the macros run. Commenting here to follow the issue and will report back if I find something. EDIT: just found this. It looks like currently the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there,
I want a struct to allow for nested data, but the field doesn't exist in the database. I can't seem to use
#[sqlx(skip)]
and ignore that field withquery_as!
.I have read through the docs and FAQ, but am not finding anything.
is there a way to tell sqlx that the field is not expected to be in the database?
This gives me:
I still want the benefit of static checking, but would like to avoid creating duplicate types with slight variations. As a workaround I have created 2 structs. One as the database response type without the additional field, which I then copy over to the 2nd type which does have that field.
I'm new to sqlx so any suggestions on best practices would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions