Simplify bulk_get_present_nexus_mod_ids query
This commit is contained in:
parent
f337917c99
commit
e534447310
@ -49,21 +49,14 @@ pub async fn bulk_get_present_nexus_mod_ids(
|
|||||||
pool: &sqlx::Pool<sqlx::Postgres>,
|
pool: &sqlx::Pool<sqlx::Postgres>,
|
||||||
nexus_mod_ids: &[i32],
|
nexus_mod_ids: &[i32],
|
||||||
) -> Result<Vec<i32>> {
|
) -> Result<Vec<i32>> {
|
||||||
struct Row {
|
sqlx::query!(
|
||||||
nexus_mod_id: i32,
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(sqlx::query_as!(
|
|
||||||
Row,
|
|
||||||
"SELECT nexus_mod_id FROM mods WHERE nexus_mod_id = ANY($1::int[])",
|
"SELECT nexus_mod_id FROM mods WHERE nexus_mod_id = ANY($1::int[])",
|
||||||
nexus_mod_ids,
|
nexus_mod_ids,
|
||||||
)
|
)
|
||||||
|
.map(|row| row.nexus_mod_id)
|
||||||
.fetch_all(pool)
|
.fetch_all(pool)
|
||||||
.await
|
.await
|
||||||
.context("Failed to get mods")?
|
.context("Failed to get mods")
|
||||||
.into_iter()
|
|
||||||
.map(|row| row.nexus_mod_id)
|
|
||||||
.collect())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(pool))]
|
#[instrument(level = "debug", skip(pool))]
|
||||||
|
Loading…
Reference in New Issue
Block a user