refactor(sql): add query_map_vec()

This also replaces some cases where flatten()
was used, effectively ignoring the errors.
This commit is contained in:
link2xt
2025-10-24 00:58:58 +00:00
committed by l
parent 45a1d81805
commit 5f3948b462
16 changed files with 83 additions and 203 deletions

View File

@@ -386,7 +386,7 @@ async fn select_expired_messages(
) -> Result<Vec<(MsgId, ChatId, Viewtype, u32)>> {
let mut rows = context
.sql
.query_map(
.query_map_vec(
r#"
SELECT id, chat_id, type, location_id
FROM msgs
@@ -407,7 +407,6 @@ WHERE
let location_id: u32 = row.get("location_id")?;
Ok((id, chat_id, viewtype, location_id))
},
|rows| rows.collect::<Result<Vec<_>, _>>().map_err(Into::into),
)
.await?;
@@ -425,7 +424,7 @@ WHERE
let rows_expired = context
.sql
.query_map(
.query_map_vec(
r#"
SELECT id, chat_id, type, location_id
FROM msgs
@@ -453,7 +452,6 @@ WHERE
let location_id: u32 = row.get("location_id")?;
Ok((id, chat_id, viewtype, location_id))
},
|rows| rows.collect::<Result<Vec<_>, _>>().map_err(Into::into),
)
.await?;