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

Function inner_join

tests/relational_tests.rs:203–285  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201
202#[sea_orm_macros::test]
203pub async fn inner_join() {
204 let ctx = TestContext::new("test_inner_join").await;
205 create_tables(&ctx.db).await.unwrap();
206
207 let bakery = bakery::ActiveModel {
208 name: Set("SeaSide Bakery".to_owned()),
209 profit_margin: Set(10.4),
210 ..Default::default()
211 }
212 .insert(&ctx.db)
213 .await
214 .expect("could not insert bakery");
215
216 let customer_kate = customer::ActiveModel {
217 name: Set("Kate".to_owned()),
218 ..Default::default()
219 }
220 .insert(&ctx.db)
221 .await
222 .expect("could not insert customer");
223
224 let _customer_jim = customer::ActiveModel {
225 name: Set("Jim".to_owned()),
226 ..Default::default()
227 }
228 .insert(&ctx.db)
229 .await
230 .expect("could not insert customer");
231
232 let kate_order_1 = order::ActiveModel {
233 bakery_id: Set(bakery.id),
234 customer_id: Set(customer_kate.id),
235 total: Set(rust_dec(15.10)),
236 placed_at: Set(Utc::now().naive_utc()),
237
238 ..Default::default()
239 }
240 .insert(&ctx.db)
241 .await
242 .expect("could not insert order");
243
244 let kate_order_2 = order::ActiveModel {
245 bakery_id: Set(bakery.id),
246 customer_id: Set(customer_kate.id),
247 total: Set(rust_dec(100.00)),
248 placed_at: Set(Utc::now().naive_utc()),
249
250 ..Default::default()
251 }
252 .insert(&ctx.db)
253 .await
254 .expect("could not insert order");
255
256 #[derive(Debug, FromQueryResult)]
257 struct SelectResult {
258 name: String,
259 order_total: Option<Decimal>,
260 }

Callers

nothing calls this directly

Calls 11

rust_decFunction · 0.85
unwrapMethod · 0.80
column_asMethod · 0.80
columnMethod · 0.80
select_onlyMethod · 0.80
inner_joinMethod · 0.80
newFunction · 0.50
create_tablesFunction · 0.50
insertMethod · 0.45
allMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected