[][src]Macro rusqlite::params

macro_rules! params {
    () => { ... };
    ($($param:expr),+ $(,)?) => { ... };
}

A macro making it more convenient to pass heterogeneous lists of parameters as a &[&dyn ToSql].

Example

struct Person {
    name: String,
    age_in_years: u8,
    data: Option<Vec<u8>>,
}

fn add_person(conn: &Connection, person: &Person) -> Result<()> {
    conn.execute("INSERT INTO person (name, age_in_years, data)
                  VALUES (?1, ?2, ?3)",
                 params![person.name, person.age_in_years, person.data])?;
    Ok(())
}