diff options
author | Teddy Wing | 2021-05-30 03:29:16 +0200 |
---|---|---|
committer | Teddy Wing | 2021-05-30 03:29:16 +0200 |
commit | a879ee3ff4b73a013eb9303e5790c2a9df0a4f5b (patch) | |
tree | 68b93c00c075939e977027a596ee4a5a0211884a | |
parent | f2f05bdba3bbcedbbc643d8d3f1122fe0b4a3ab2 (diff) | |
download | reflectub-a879ee3ff4b73a013eb9303e5790c2a9df0a4f5b.tar.bz2 |
database::repo_is_updated: Use `fetch_optional`
I think I like this better than checking the `RowNotFound` error.
-rw-r--r-- | src/database.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database.rs b/src/database.rs index 375ca3b..e735df9 100644 --- a/src/database.rs +++ b/src/database.rs @@ -126,11 +126,11 @@ impl Db { "#) .bind(repo.id) .bind(&repo.updated_at) - .fetch_one(&mut tx) + .fetch_optional(&mut tx) .await { - Ok(r) => Ok(true), - Err(sqlx::Error::RowNotFound) => Ok(false), + Ok(Some(_)) => Ok(true), + Ok(None) => Ok(false), Err(e) => Err(e.into()), }; |