sea-orm
sea-orm copied to clipboard
Add `into_tuple` to `SelectTwo` and `SelectTwoMany`
Motivation
Currently into_tuple
only works on single Select
queries. This leads to inconsistencies between the different query types and as such it should be extended to support the SelectTwo
and SelectTwoMany
queries.
Code like this should work
let res = Email::find_by_id(email_id)
.select_only()
.find_also_related(Thread)
.column(thread::Column::Id)
.into_tuple()
.one(db)
.await?;
Proposed Solutions
into_tuple
should work the same as it currently does with Select
Current Workarounds
Currently you can query normally and get a struct in return but getting a tuple directly could help reduce code verbosity.
+1 I also need this method because after multiple join associations, I may only be concerned about a few fields.
Maybe into_tuple()
and similar methods should be moved into some trait to prevent such inconsistencies in the future?