refactor(sql): add query_map_collect()

This commit is contained in:
link2xt
2025-10-24 01:36:47 +00:00
committed by l
parent 5f3948b462
commit c001a9a983
4 changed files with 30 additions and 21 deletions

View File

@@ -951,7 +951,7 @@ impl ChatId {
let chat_size: HashMap<ChatId, f64> = context
.sql
.query_map(
.query_map_collect(
"SELECT chat_id, count(*) AS n
FROM chats_contacts
WHERE contact_id > ? AND chat_id > ?
@@ -963,10 +963,6 @@ impl ChatId {
let size: f64 = row.get(1)?;
Ok((chat_id, size))
},
|rows| {
rows.collect::<std::result::Result<HashMap<ChatId, f64>, _>>()
.map_err(Into::into)
},
)
.await
.context("failed to count chat member sizes")?;