macro_rules! query {
($sql:literal) => { ... };
}Expand description
Parameterized SQL query that only accepts string literals.
Prevents SQL injection by rejecting runtime-constructed strings at
compile time. Use .bind() for all dynamic values.
§Example
ⓘ
use blixt::prelude::*;
let todos = query!("SELECT id, title FROM todos WHERE id = ?")
.bind(id)
.fetch_one(&pool)
.await?;§Compile-time safety
ⓘ
// format!() is not a string literal -- rejected at compile time
let sql = format!("SELECT * FROM users WHERE name = '{}'", "test");
blixt::query!(sql);