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/// Schema branching.
15pub mod branch;
16/// Build-time schema validation.
17pub mod build;
18/// Code generation for typed schema modules.
19pub mod codegen;
20/// Configuration types.
21pub mod config;
22/// Error types.
23pub mod error;
24/// SQL formatter.
25pub mod fmt;
26/// Database migration types.
27pub mod migrate;
28/// Query normalization and optimizer support.
29pub mod optimizer;
30/// QAIL query parser.
31pub mod parser;
32/// Row-level security context.
33pub mod rls;
34/// AST structural sanitization for untrusted binary input.
35pub mod sanitize;
36/// Schema definitions for validation.
37pub mod schema;
38/// Filesystem schema source loader (`schema.qail` or modular `schema/`).
39pub mod schema_source;
40/// SQL transpiler (AST to SQL).
41pub mod transpiler;
42/// Typed column and table traits.
43pub mod typed;
44/// Schema validator.
45pub mod validator;
46/// Serde-free AST wire codec.
47pub mod wire;
48
49#[cfg(test)]
50mod proptest;
51
52pub use parser::parse;
53
54/// Ergonomic alias for Qail - the primary query builder type.
55pub type Qail = ast::Qail;
56
57/// Common re-exports for convenient wildcard imports.
58pub mod prelude {
59 pub use crate::ast::builders::{
60 // Extension traits
61 ExprExt,
62 add_expr,
63 all,
64 and,
65 and3,
66 avg,
67 binary,
68 bind,
69 boolean,
70 case_when,
71 // Expression builders
72 cast,
73 // Function builders
74 coalesce,
75 // Column builders
76 col,
77 concat,
78 cond,
79 // Aggregate builders
80 count,
81 count_distinct,
82 count_filter,
83 count_where,
84 count_where_all,
85 // Condition builders
86 eq,
87 float,
88 func,
89 gt,
90 gte,
91 ilike,
92 in_list,
93 inc,
94 int,
95 interval,
96 is_in,
97 is_not_null,
98 is_null,
99 // JSON builders
100 json,
101 json_obj,
102 json_path,
103 like,
104 lt,
105 lte,
106 max,
107 min,
108 ne,
109 not_in,
110 now,
111 now_minus,
112 now_plus,
113 null,
114 nullif,
115 param,
116 percentage,
117 // Shortcut helpers
118 recent,
119 recent_col,
120 replace,
121 star,
122 sum,
123 // Literal builders
124 text,
125 };
126 pub use crate::ast::*;
127
128 pub use crate::Qail;
129 pub use crate::error::*;
130 pub use crate::parser::parse;
131 pub use crate::transpiler::ToSql;
132}