From cce6662d635bb2115f9f2a7bab92cc105166e761 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Wed, 18 Sep 2024 01:27:47 -0400 Subject: App methods now return errors that allow not-found cases to be distinguished. --- src/repo/token.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/repo/token.rs') diff --git a/src/repo/token.rs b/src/repo/token.rs index 01a982e..5674c92 100644 --- a/src/repo/token.rs +++ b/src/repo/token.rs @@ -88,7 +88,7 @@ impl<'c> Tokens<'c> { &mut self, secret: &str, used_at: DateTime, - ) -> Result, sqlx::Error> { + ) -> Result { // I would use `update … returning` to do this in one query, but // sqlite3, as of this writing, does not allow an update's `returning` // clause to reference columns from tables joined into the update. Two @@ -117,7 +117,7 @@ impl<'c> Tokens<'c> { "#, secret, ) - .fetch_optional(&mut *self.0) + .fetch_one(&mut *self.0) .await?; Ok(login) -- cgit v1.2.3