toasty 0.6.0

An async ORM for Rust supporting SQL and NoSQL databases
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use toasty_core::stmt::{self, Expr, Value};

/// Cheap canonicalization for `is_superset(lhs, rhs)`: an empty rhs makes
/// the predicate vacuously true (every collection is a superset of the
/// empty set), regardless of `lhs`. The rhs is the user-supplied set
/// literal — `tags.is_superset(values)` — so an empty list here means
/// the caller passed `[]`.
pub(super) fn fold_expr_is_superset(expr: &mut stmt::ExprIsSuperset) -> Option<Expr> {
    if expr.rhs.is_list_empty() {
        return Some(Expr::Value(Value::Bool(true)));
    }
    None
}