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