Version 1: Calls 4 queries in sequential order, as an asynchronous handler
(db: web::Data<Pool>)
| 23 | |
| 24 | /// Version 1: Calls 4 queries in sequential order, as an asynchronous handler |
| 25 | async fn asyncio_weather(db: web::Data<Pool>) -> Result<HttpResponse, AWError> { |
| 26 | let result = vec![ |
| 27 | db::execute(&db, Queries::GetTopTenHottestYears).await?, |
| 28 | db::execute(&db, Queries::GetTopTenColdestYears).await?, |
| 29 | db::execute(&db, Queries::GetTopTenHottestMonths).await?, |
| 30 | db::execute(&db, Queries::GetTopTenColdestMonths).await?, |
| 31 | ]; |
| 32 | |
| 33 | Ok(HttpResponse::Ok().json(result)) |
| 34 | } |
| 35 | |
| 36 | /// Version 2: Calls 4 queries in parallel, as an asynchronous handler |
| 37 | /// Returning Error types turn into None values in the response |
nothing calls this directly
no outgoing calls
no test coverage detected