Rust-mysql-simple and WHERE IN queries with Vec<usize>


#1

I’m trying to do a WHERE IN query with rust-mysql-simple. It looks roughly like this:

let ids: Vec<usize> = vec![355, 356, 357];

let records: Vec<Record> = pool
    .prep_exec(
        r"SELECT
     id,
     SUM(total) as total
 WHERE
     id IN :ids
 GROUP BY id",
        (ids)
).map(|result| {
    result
       .map(|x| x.unwrap())
       .map(|row| {
            let (id, total): (usize, f64) = my::from_row(row);

            Record {
                id: id,
                total: total
            }
        }).collect()
    }).unwrap();

However I’m getting this from the compiler:

the trait `std::convert::From<std::vec::Vec<usize>>` is not implemented for `mysql::Value`

I checked the implementations of From for mysql::Value but the most similar I found was Vec<u8> which is too small for this case and I believe it’s intended for bytes instead.

What’s the adequate way to do a WHERE IN query while using rust-mysql-simple?