Macro or

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

This macro is used to simplify the creation of disjunctive Conditions. It takes a variadic amount of conditions and places them in a Condition::Disjunction.

It does not try to simplify any conditions where one or no conditions are passed, so no one gets confused. This also ensures, that the return type of this macro is always Condition::Disjunction.

Usage:

use rorm_sql::or;
use rorm_sql::conditional::Condition;
use rorm_sql::conditional::BinaryCondition;
use rorm_sql::value::Value;

let condition = or!(
    Condition::BinaryCondition(
        BinaryCondition::Equals(Box::new([
            Condition::Value(Value::Ident("id")),
            Condition::Value(Value::I64(23)),
        ]))
    ),
    Condition::BinaryCondition(
        BinaryCondition::Like(Box::new([
            Condition::Value(Value::Ident("foo")),
            Condition::Value(Value::String("%bar")),
        ]))
    ),
);