tideorm-sql-builder 0.2.1

SQL builder for TideORM
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::*;

#[test]
fn test_blank_condition() {
    let query = Query::select()
        .column("image")
        .from("glyph")
        .cond_where(Cond::all())
        .cond_where(Expr::val(1).eq(1))
        .cond_where(Expr::val(2).eq(2))
        .cond_where(Cond::any().add(Expr::val(3).eq(3)).add(Expr::val(4).eq(4)))
        .to_owned();

    assert_eq!(
        query.to_string(MysqlQueryBuilder).unwrap(),
        "SELECT `image` FROM `glyph` WHERE 1 = 1 AND 2 = 2 AND (3 = 3 OR 4 = 4)"
    );
}