Skip to main content

and_all

Function and_all 

Source
pub fn and_all<I>(conditions: I) -> Option<Expr>
where I: IntoIterator<Item = Expr>,
Expand description

Combine multiple conditions with AND.

§Arguments

  • conditions - Iterator of expressions to combine

§Examples

use sqlglot_rust::builder::{and_all, column};
use sqlglot_rust::ast::{Expr, BinaryOperator};

let cond1 = Expr::BinaryOp {
    left: Box::new(column("x", None)),
    op: BinaryOperator::Gt,
    right: Box::new(Expr::Number("1".to_string())),
};
let cond2 = Expr::BinaryOp {
    left: Box::new(column("y", None)),
    op: BinaryOperator::Lt,
    right: Box::new(Expr::Number("10".to_string())),
};

let combined = and_all(vec![cond1, cond2]);