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