From 15404778b3e01c90111c5eccb9fd96644a257d49 Mon Sep 17 00:00:00 2001 From: Vika Date: Wed, 1 Jan 2025 04:48:08 +0300 Subject: PostgresStorage: use query_scalar for post_exists Simplifes typing a little. Change-Id: I2a686e5c8ce09efc047d7caec687911f08eb7628 --- src/database/postgres/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/database/postgres/mod.rs b/src/database/postgres/mod.rs index 1a1b98d..2c2dacc 100644 --- a/src/database/postgres/mod.rs +++ b/src/database/postgres/mod.rs @@ -100,11 +100,10 @@ WHERE } #[tracing::instrument(skip(self))] async fn post_exists(&self, url: &str) -> Result { - sqlx::query_as::<_, (bool,)>("SELECT exists(SELECT 1 FROM kittybox.mf2_json WHERE uid = $1 OR mf2['properties']['url'] ? $1)") + sqlx::query_scalar::<_, bool>("SELECT exists(SELECT 1 FROM kittybox.mf2_json WHERE uid = $1 OR mf2['properties']['url'] ? $1)") .bind(url) .fetch_one(&self.db) .await - .map(|v| v.0) .map_err(|err| err.into()) } -- cgit 1.4.1