Support macros for Rust-Postgres
Rust C Makefile
Latest commit eb77a11 Dec 18, 2016 @sfackler Release v0.1.13


A set of support macros for Rust-Postgres.

Build Status

You can integrate rust-postgres-macros into your project through the releases on

# Cargo.toml
postgres_macros = "0.1"


The sql! macro will validate that its string literal argument parses as a valid Postgres query.


fn main() {
    let query = sql!("SELECT * FROM users WHERE name = $1");
    let bad_query = sql!("SELECT * FORM users WEHRE name = $1");
} 8:63 error: Invalid syntax at position 10: syntax error at or near "FORM"     let bad_query = sql!("SELECT * FORM users WEHRE name = $1");
error: aborting due to previous error


Major thanks to pganalyze for their writeup on how to link to the Postgres query parser directly!


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.