I am running a Rocket server and using rocket_db_pools
for postgres connectivity. I would like to execute multiple queries in the same database within the context of an API call - like so.
#[get("/fetch_data_by_ids?<data_ids>")]
async fn fetch_data_by_ids(data_ids: Vec<&str>, mut db: Connection<DatabaseConnection>) -> Json<Vec<ProcessedDocument>> {
let connection_one = db.clone();
let connection_two = db.clone();
let data_obj_one = do_a_database_process_one(connection_one).await;
let data_obj_two = do_a_database_process_two(connection_two).await;
}
Is it possible to request multiple connections within one route handler?
It's possible to get multiple connections to the same DB by
Kind of hack-y but the only solution I have currently.