Select only part of fields #304
Answered
by
billy1624
YoshieraHuang
asked this question in
Q&A
-
Hi guys, can |
Beta Was this translation helpful? Give feedback.
Answered by
billy1624
Nov 8, 2021
Replies: 2 comments
-
Hi @YoshieraHuang, yes you can! // Selecting the name column only
assert_eq!(
cake::Entity::find()
.select_only()
.column(cake::Column::Name)
.build(DbBackend::Postgres)
.to_string(),
r#"SELECT "cake"."name" FROM "cake""#
); And, you can derive sea-orm/tests/relational_tests.rs Lines 663 to 689 in 6a0db92 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
tyt2y3
-
Uhh @billy1624 , I find this at |
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 @YoshieraHuang, yes you can!
And, you can derive
FromQueryResult
if want to select partial fields into custom struct.sea-orm/tests/relational_tests.rs
Lines 663 to 689 in 6a0db92