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 config;
15pub mod error;
16pub mod fmt;
17pub mod migrate;
18pub mod parser;
19pub mod rls;
20pub mod schema;
21pub mod transformer;
22pub mod transpiler;
23pub mod typed;
24pub mod validator;
25
26#[cfg(test)]
27mod proptest;
28
29pub use parser::parse;
30
31/// Ergonomic alias for Qail - the primary query builder type.
32pub type Qail = ast::Qail;
33
34pub mod prelude {
35    pub use crate::ast::*;
36    pub use crate::ast::builders::{
37        // Column builders
38        col, param, star,
39        // Aggregate builders
40        count, count_distinct, count_filter, count_where, count_where_all,
41        sum, avg, max, min,
42        // Condition builders  
43        eq, ne, gt, gte, lt, lte, is_null, is_not_null, is_in, not_in, like, ilike,
44        cond,
45        // Literal builders
46        text, int, float, boolean, null, bind,
47        // Expression builders
48        cast, now, now_minus, now_plus, interval, binary, case_when,
49        // Function builders
50        coalesce, func, replace, nullif, concat,
51        // JSON builders
52        json, json_path, json_obj,
53        // Shortcut helpers
54        recent, recent_col, in_list, percentage, all, and, and3,
55        // Extension traits
56        ExprExt,
57    };
58
59    pub use crate::error::*;
60    pub use crate::parser::parse;
61    pub use crate::transpiler::ToSql;
62    pub use crate::Qail;
63}