diff options
author | Vika <vika@fireburn.ru> | 2025-01-01 04:48:08 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2025-01-01 04:48:08 +0300 |
commit | 15404778b3e01c90111c5eccb9fd96644a257d49 (patch) | |
tree | ea49e7abc0c81a18efa680f9e201a688d06f059c | |
parent | 2e70534967447e1c34c68d21444a81b851bd4d13 (diff) | |
download | kittybox-15404778b3e01c90111c5eccb9fd96644a257d49.tar.zst |
PostgresStorage: use query_scalar for post_exists
Simplifes typing a little. Change-Id: I2a686e5c8ce09efc047d7caec687911f08eb7628
-rw-r--r-- | src/database/postgres/mod.rs | 3 |
1 files changed, 1 insertions, 2 deletions
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<bool> { - 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()) } |