Struct postgres::types::Slice
[−]
[src]
pub struct Slice<'a, T: 'a + ToSql>(pub &'a [T]);
An adapter type mapping slices to Postgres arrays.
Slice
's ToSql
implementation maps the slice to a one-dimensional
Postgres array of the relevant type. This is particularly useful with the
ANY
function to match a column against multiple values without having
to dynamically construct the query string.
Examples
let values = &[1i32, 2, 3, 4, 5, 6]; let stmt = try!(conn.prepare("SELECT * FROM foo WHERE id = ANY($1)")); for row in &try!(stmt.query(&[&Slice(values)])) { // ... }