query_args!() { /* proc-macro */ }Expand description
The macro returns a tuple containing the query and the parameter slice that can be used to call the various query methods provided by rust_postgres/tokio_postgres.
Please refer to the crate level documentation for an overview of the syntax.
A complete example could look something like:
let name = "Fred";
let surname = "Flintstone";
let (query, params) = query_args!(
r"INSERT INTO flintstone($[name, surname]) VALUES($[..])",
Args { name, surname }
);ⓘ
txn.execute(query, params).await?;