Protocol-First Data Layer
QAIL builds queries as typed objects and encodes them as protocol bytes. No hand-built SQL interpolation on the AST path, with RLS and validation still enforced where they belong.
cargo install qail zig fetch --save ...qail-zig/v0.2.0.tar.gz First-party language drivers: Rust and Zig ยท Latest stable: v0.25.1 (March 18, 2026)
Qail::get("users")
.select_all()
.filter("active", Eq, true) SELECT * FROM users WHERE active = $1 { "must": [{ "key": "active", "match": true }] }
Same query. Same database. Same 50-row result set with 3 JOINs.
100 iterations, release build, buffer cache warmed.
Snapshot run: February 2026.
QAIL executes one planned query on this path. Naive resolver/endpoint patterns can explode to 151 round-trips without join batching.
Four layers. One AST flows through all of them.
Parser, transpiler, type system. Queries are typed data structures, not hand-built SQL strings in app code. Schema validation at compile time.
get users fields id, email
where active = true
order by created_at desc
limit 10 Protocol-level PostgreSQL driver with typed values and built-in RLS context per connection.
let driver = PgDriver::connect_env().await?;
driver.set_rls_context(
RlsContext::operator("op-456")
).await?;
driver.fetch_all(&cmd).await? Zero-code API from your schema. Auto-REST with FK expansion, policy engine, WebSocket subscriptions, binary AST wire format.
GET /api/bookings
?status.eq=confirmed
&sort=created_at:desc
&expand=routes,payments
&limit=20 Declarative multi-step orchestration. Database queries, notifications, and events in typed state machines.
Workflow::new("booking")
.step("validate", validate_fn)
.step("charge", payment_fn)
.step("confirm", confirm_fn)
.on_error(rollback_fn) REST params, text queries, or binary AST all converge to the same AST. Policy injection and schema validation happen once. SQL text output is optional for tooling/debug views.
GET /api/users?active=true get users where active = true postcard::to_allocvec(&cmd) Qail { action: Get, table: "users", cages: [Filter(active = true)] } + injects AND operator_id = 'op-456' Encode AST โ Parse / Bind / Execute + typed bind values Two production databases, one typed AST, plus built-in cache for hot paths.
Relational โข Transactions โข ACID
ProductionVector โข AI/ML โข Semantic Search
ProductionMoka โข TTL โข Zero Latency
Built-inOfficially supported today: Zig and Rust.
Pure Zig โข TLS โข Pool v0.2.0 cargo add qail-core Cargo Migration pipeline with policy checks, receipt verification, and explicit unsafe guards.
Searches .rs, .ts, .js, .py for queries that reference changing columns
Shows exactly where your code needs updating before migration
Use --force to override when you know better
One AST. Protocol bytes. Compile-time safety. Built-in RLS.