Macro fire_postgres::whr

source ·
macro_rules! whr {
    ($($tt:tt)*) => { ... };
}
Expand description

Possible operators

  • = | != | < | <= | > | >= | LIKE | IN
  • AND | OR

~ | = | = are shortcuts for LIKE

§Example

use fire_postgres::whr;
let a = "val";
let b = "val2".to_string();
let c: Option<String> = None;
let query = whr!(&a AND "b" != &b OR &c);

assert_eq!(r#" WHERE "a" = $1 AND "b" != $2 OR "c" IS NULL"#, query.to_string());