macro_rules! params { () => { ... }; ($($param:expr),+ $(,)?) => { ... }; }
Expand description
A macro making it more convenient to longer 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(())
}