mirror of
https://github.com/chatmail/core.git
synced 2026-04-21 15:36:30 +03:00
refactor(sql): add query_map_vec()
This also replaces some cases where flatten() was used, effectively ignoring the errors.
This commit is contained in:
@@ -349,19 +349,10 @@ pub(crate) struct Scheduler {
|
||||
async fn download_msgs(context: &Context, session: &mut Session) -> Result<()> {
|
||||
let msg_ids = context
|
||||
.sql
|
||||
.query_map(
|
||||
"SELECT msg_id FROM download",
|
||||
(),
|
||||
|row| {
|
||||
let msg_id: MsgId = row.get(0)?;
|
||||
Ok(msg_id)
|
||||
},
|
||||
|rowids| {
|
||||
rowids
|
||||
.collect::<std::result::Result<Vec<_>, _>>()
|
||||
.map_err(Into::into)
|
||||
},
|
||||
)
|
||||
.query_map_vec("SELECT msg_id FROM download", (), |row| {
|
||||
let msg_id: MsgId = row.get(0)?;
|
||||
Ok(msg_id)
|
||||
})
|
||||
.await?;
|
||||
|
||||
for msg_id in msg_ids {
|
||||
|
||||
Reference in New Issue
Block a user