Skip to main content

params

Macro params 

Source
macro_rules! params {
    () => { ... };
    ($($val:expr),+ $(,)?) => { ... };
}
Expand description

Macro for building prepared statement parameters with automatic encoding.

ยงExamples

let stmt = client.prepare("SELECT * FROM t WHERE id = $1 AND name = $2")?;

// Pass typed values directly
let rows = client.execute(&stmt, params![42_i32, "Alice"])?;

// For NULL values, use None explicitly
let rows = client.execute(&stmt, &[Some(42_i32.encode()), None])?;