Skip to content

Commit

Permalink
style: remove non-existing section in the readme and format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Net-Mist committed Jan 12, 2024
1 parent 4e93ac3 commit 83e86b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
1 change: 0 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
- [Technology stack](#technology-stack)
- [CI](#ci)
- [Test](#test)
- [TODO](#todo)
<!--toc:end-->

Solution of the [developer-test](https://github.com/lioncowlionant/developer-test).
Expand Down
31 changes: 17 additions & 14 deletions src/infrastructure_services/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,23 @@ pub async fn get_routes_from_db(db_path: &Path) -> Result<Vec<Route>> {
.await
.context(format!("Unable to connect the the database at {db_path}"))?;

let routes: Vec<Route> = sqlx::query_as!(RouteDB, "SELECT origin, destination, travel_time FROM ROUTES")
.fetch_all(&pool)
.await?
.into_iter()
.filter_map(
|d| match d.try_into().context("Issue reading route in the database") {
Ok(v) => Some(v),
Err(e) => {
println!("{e:#?}");
None
}
},
)
.collect();
let routes: Vec<Route> = sqlx::query_as!(
RouteDB,
"SELECT origin, destination, travel_time FROM ROUTES"
)
.fetch_all(&pool)
.await?
.into_iter()
.filter_map(
|d| match d.try_into().context("Issue reading route in the database") {
Ok(v) => Some(v),
Err(e) => {
println!("{e:#?}");
None
}
},
)
.collect();

Ok(routes)
}

0 comments on commit 83e86b7

Please sign in to comment.