MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / select_only_exclude_option_fields

Function select_only_exclude_option_fields

tests/query_tests.rs:189–224  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

187
188#[sea_orm_macros::test]
189pub async fn select_only_exclude_option_fields() {
190 let ctx = TestContext::new("select_only_exclude_option_fields").await;
191 create_tables(&ctx.db).await.unwrap();
192
193 let _ = customer::ActiveModel {
194 name: Set("Alice".to_owned()),
195 notes: Set(Some("Want to communicate with Bob".to_owned())),
196 ..Default::default()
197 }
198 .save(&ctx.db)
199 .await
200 .expect("could not insert customer");
201
202 let _ = customer::ActiveModel {
203 name: Set("Bob".to_owned()),
204 notes: Set(Some("Just listening".to_owned())),
205 ..Default::default()
206 }
207 .save(&ctx.db)
208 .await
209 .expect("could not insert customer");
210
211 let customers = Customer::find()
212 .select_only()
213 .column(customer::Column::Id)
214 .column(customer::Column::Name)
215 .all(&ctx.db)
216 .await
217 .unwrap();
218
219 assert_eq!(customers.len(), 2);
220 assert_eq!(customers[0].notes, None);
221 assert_eq!(customers[1].notes, None);
222
223 ctx.delete().await;
224}

Callers

nothing calls this directly

Calls 8

unwrapMethod · 0.80
saveMethod · 0.80
columnMethod · 0.80
select_onlyMethod · 0.80
newFunction · 0.50
create_tablesFunction · 0.50
allMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected