sqlz is a SQL toolkit for Zig. You keep writing SQL; sqlz checks it at build time against a schema rebuilt from your migrations and generates typed Zig bindings for it. At runtime it executes those queries on SQLite or PostgreSQL through thin adapters over zqlite and pg.zig.

sqlz is not an ORM. It has no model persistence, relationships or query builder. Your application keeps control of SQL, connections, transactions, allocation and domain types.

How it works

  1. Migrations are the schema. The checker replays your migration history into an in-memory catalog for each configured backend.
  2. Queries are checked on the host. A normal host program parses each query with libpg_query (plus a narrow SQLite layer) and checks names, types and nullability. Nothing is parsed at comptime.
  3. Bindings are generated into the build cache. Each query becomes a declaration with a typed params struct, a row struct and methods for its cardinality.

Status

sqlz is pre-release. Checking, generated bindings and both runtimes work for the current SQL subset. Running migrations against a database (state, locking, upgrade and downgrade) is not implemented yet.

The current-status table in the design documents is the authority on what exists today.

Where to start