Replies: 2 comments 1 reply
-
I think I would be fine with allowing that for |
Beta Was this translation helpful? Give feedback.
-
Added for Queryable in #3782 Should I leave this open for QueryableByName or close and re-open in case I get to work on that one? |
Beta Was this translation helpful? Give feedback.
-
In the issue #1314 it was discussed to add multiple table names for
Insertable
which got implemented in #3535However, I'm having an issue with this because when I want to derive
Insertable
andQueryable
/QueryableByName
for a struct I need to use two different structs. I'm hacking around this implementingFrom
one to the other to avoid too much code.In the discussion I couldn't find any mention of why
Queryable
andQueryableByName
were excluded.Queryable: it doesn't use the table name so the restriction could be lifted: https://github.com/diesel-rs/diesel/blob/master/diesel_derives/src/queryable.rs
QueryableByName uses the table name to guess the types of the SQL columns but we could use the non-guessing path if there are multiple table names or compare that the type is the same in all the tables: https://github.com/diesel-rs/diesel/blob/master/diesel_derives/src/queryable_by_name.rs#L117 . Or other ideas?
There is also the discussion if we really want this as it may break backwards compatiblity once implemented if there are other features planned for the derives.
I can make a PR for either of those. I think implementing it for Queryable is trivial and it would just need a test.
Beta Was this translation helpful? Give feedback.
All reactions