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

Function count_fruits_by_cake_json

examples/basic/src/select.rs:274–290  ·  view source on GitHub ↗
(db: &DbConn)

Source from the content-addressed store, hash-verified

272}
273
274async fn count_fruits_by_cake_json(db: &DbConn) -> Result<(), DbErr> {
275 print!("count fruits by cake: ");
276
277 let count = Cake::find()
278 .left_join(Fruit)
279 .select_only()
280 .column(cake::Column::Name)
281 .column_as(fruit::Column::Id.count(), "num_of_fruits")
282 .group_by(cake::Column::Name)
283 .into_json()
284 .all(db)
285 .await?;
286
287 println!("\n{}\n", serde_json::to_string_pretty(&count).unwrap());
288
289 Ok(())
290}
291
292async fn find_all_stream(db: &DbConn) -> Result<(), DbErr> {
293 use async_std::task::sleep;

Callers 1

all_about_select_jsonFunction · 0.85

Calls 8

group_byMethod · 0.80
column_asMethod · 0.80
columnMethod · 0.80
select_onlyMethod · 0.80
left_joinMethod · 0.80
countMethod · 0.80
allMethod · 0.45
into_jsonMethod · 0.45

Tested by

no test coverage detected