macro_rules! params {
($($value:expr),* $(,)?) => { ... };
}Expand description
Builds the parameter list of a Db query: params![title, id].
Each value goes through IntoParam, so strings, integers, floats,
booleans, Options of those (None binds NULL) and JSON values can be
mixed. Values bind to the ?1, ?2, … placeholders in order. The result
is a Vec<Param>, the type every Db method and Statement::new
take; params![] binds nothing.
§Examples
use ocre::{Param, params};
let title = "Hello";
let published: Option<bool> = None;
let params: Vec<Param> = params![title, 42, published];
assert_eq!(params.len(), 3);
let none: Vec<Param> = params![];
assert!(none.is_empty());