| Crates.io | qail-core |
| lib.rs | qail-core |
| version | 0.14.22 |
| created_at | 2025-12-20 18:31:14.808517+00 |
| updated_at | 2026-01-10 13:47:30.04133+00 |
| description | AST-native query builder - type-safe expressions, zero SQL strings |
| homepage | |
| repository | https://github.com/qail-io/qail |
| max_upload_size | |
| id | 1996828 |
| size | 728,025 |
The AST-native query builder — No SQL strings, no ORM magic, just type-safe expressions.
| Approach | How it works | Safety Level |
|---|---|---|
| String-based | SQL as strings | Requires parameterization |
| ORM | Macros generate SQL | Compile-time safe |
| AST-Native (QAIL) | Typed AST → Wire protocol | Structurally safe |
QAIL builds queries as an Abstract Syntax Tree that compiles directly to database wire protocol. There's no SQL string generation step—safety is built into the design.
[!CAUTION] Alpha Software: QAIL is currently in alpha. While we strive for stability, the API is evolving to ensure it remains ergonomic and truly AST-native. Do not use in production environments yet.
[dependencies]
qail-core = "0.13.1"
use qail_core::{Qail, Operator};
use qail_core::ast::builders::*;
// Build a query as typed AST
let cmd = Qail::get("users")
.columns([col("id"), col("name"), col("email")])
.filter(eq("active", true))
.order_by([("created_at", Desc)])
.limit(10);
// Use with qail-pg driver
let rows = driver.fetch_all(&cmd).await?;
use qail_core::ast::builders::*;
// Aggregates with FILTER
count_filter(vec![eq("status", "active")]).alias("active_users")
// Time expressions
now_minus("24 hours") // NOW() - INTERVAL '24 hours'
// CASE WHEN
case_when(gt("score", 80), text("pass"))
.otherwise(text("fail"))
.alias("result")
// Type casting
cast(col("amount"), "float8")
count(), sum(), case_when(), now_minus()->, ->>, @>, ?| Crate | Purpose |
|---|---|
| qail-core | AST builder, parser, expression helpers |
| qail-pg | PostgreSQL driver (AST → wire protocol) |
| qail | CLI tool for migrations and schema ops |
MIT
We welcome issue reports on GitHub! Please provide detailed descriptions to help us reproduce and fix the problem. We aim to address critical issues within 1-5 business days.