Skip to main content

qail_core/
lib.rs

1//! Type-safe SQL query builder with AST-native design.
2//!
3//! Build queries as typed AST, not strings. Zero SQL injection risk.
4//!
5//! ```ignore
6//! use qail_core::ast::{Qail, Operator};
7//! let cmd = Qail::get("users").column("name").filter("active", Operator::Eq, true);
8//! ```
9
10pub mod analyzer;
11pub mod ast;
12pub mod build;
13pub mod codegen;
14pub mod error;
15pub mod fmt;
16pub mod migrate;
17pub mod parser;
18pub mod rls;
19pub mod schema;
20pub mod transformer;
21pub mod transpiler;
22pub mod typed;
23pub mod validator;
24
25#[cfg(test)]
26mod proptest;
27
28pub use parser::parse;
29
30/// Ergonomic alias for Qail - the primary query builder type.
31pub type Qail = ast::Qail;
32
33pub mod prelude {
34    pub use crate::ast::*;
35    pub use crate::ast::builders::{
36        // Column builders
37        col, param, star,
38        // Aggregate builders
39        count, count_distinct, count_filter, count_where, count_where_all,
40        sum, avg, max, min,
41        // Condition builders  
42        eq, ne, gt, gte, lt, lte, is_null, is_not_null, is_in, not_in, like, ilike,
43        cond,
44        // Literal builders
45        text, int, float, boolean, null, bind,
46        // Expression builders
47        cast, now, now_minus, now_plus, interval, binary, case_when,
48        // Function builders
49        coalesce, func, replace, nullif, concat,
50        // JSON builders
51        json, json_path, json_obj,
52        // Shortcut helpers
53        recent, recent_col, in_list, percentage, all, and, and3,
54        // Extension traits
55        ExprExt,
56    };
57
58    pub use crate::error::*;
59    pub use crate::parser::parse;
60    pub use crate::transpiler::ToSql;
61    pub use crate::Qail;
62}