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;
12/// Abstract syntax tree types.
13pub mod ast;
14/// Build-time schema validation.
15pub mod build;
16/// Code generation for typed schema modules.
17pub mod codegen;
18/// Configuration types.
19pub mod config;
20/// Error types.
21pub mod error;
22/// SQL formatter.
23pub mod fmt;
24/// Database migration types.
25pub mod migrate;
26/// QAIL query parser.
27pub mod parser;
28/// Row-level security context.
29pub mod rls;
30/// Schema branching.
31pub mod branch;
32/// Schema definitions for validation.
33pub mod schema;
34#[cfg(feature = "analyzer")]
35pub mod transformer;
36/// SQL transpiler (AST to SQL).
37pub mod transpiler;
38/// Typed column and table traits.
39pub mod typed;
40/// Schema validator.
41pub mod validator;
42
43#[cfg(test)]
44mod proptest;
45
46pub use parser::parse;
47
48/// Ergonomic alias for Qail - the primary query builder type.
49pub type Qail = ast::Qail;
50
51/// Common re-exports for convenient wildcard imports.
52pub mod prelude {
53 pub use crate::ast::*;
54 pub use crate::ast::builders::{
55 // Column builders
56 col, param, star,
57 // Aggregate builders
58 count, count_distinct, count_filter, count_where, count_where_all,
59 sum, avg, max, min,
60 // Condition builders
61 eq, ne, gt, gte, lt, lte, is_null, is_not_null, is_in, not_in, like, ilike,
62 cond,
63 // Literal builders
64 text, int, float, boolean, null, bind,
65 // Expression builders
66 cast, now, now_minus, now_plus, interval, binary, case_when,
67 // Function builders
68 coalesce, func, replace, nullif, concat,
69 // JSON builders
70 json, json_path, json_obj,
71 // Shortcut helpers
72 recent, recent_col, in_list, percentage, all, and, and3,
73 // Extension traits
74 ExprExt,
75 };
76
77 pub use crate::error::*;
78 pub use crate::parser::parse;
79 pub use crate::transpiler::ToSql;
80 pub use crate::Qail;
81}