Macro whr

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

Possible operators

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

ยงExample

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

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