main function

void main()

Implementation

void main() {
  print((QueryBuild()
        ..table(Table.from("t1"))
        ..where(Eq("a", 1)))
      .toString()
      .compareTo("select * from `t1` where `a` = 1"));
  var t1Table = Table.from("q1");
  var t2Table = Table.from("q2");

  print((QueryBuild()
        ..table(t1Table)
        ..select("${t1Table.f("a")}, ${t2Table.f("c")}")
        ..join(LeftJoin(table: t2Table)..on(Eq(t1Table.f("a"), t2Table.f("b"))))
        ..where(Gt(t1Table.f("a"), 5)))
      .toString()
      .compareTo(
          '''select `q1`.`a`, `q2`.`c` from `q1` left join `q2` on `q1`.`a` = `q2`.`b` where `q1`.`a` > 5'''));

  print((QueryBuild()
        ..table(t1Table)
        ..select("a")
        ..where(Or([
          And([
            Eq("a", 1),
            In("b", ["1", "ab"]),
          ]),
          And([
            Eq("c", "2"),
            In("d", [1, 2, 3]),
          ])
        ])))
      .toString()
      .compareTo(
          '''select `a` from `q1` where ((`a` = 1) and (`b` in ("1","ab"))) or ((`c` = "2") and (`d` in (1,2,3)))'''));
}