Skip to content

API Reference

Overview of the sqlite.zig public API.

Core Types

TypeDescription
ConnectionDatabase connection handle — open, close, exec, and manage transactions
ResultQuery result set — rows, columns, and row count
StatementPrepared statement with parameter binding
ValueUnion type for column values (integer, real, text, blob, null)
ExprDSL expression for WHERE clauses and conditions

Top-Level Functions

zig
const sqlite = @import("sqlite");

// Open a database
var db = try sqlite.open(allocator, "my_database.db");
defer db.close();

// Execute raw SQL
var result = try db.exec("SELECT * FROM users;");
defer result.deinit();

Table Definition

zig
const User = sqlite.table("users", struct {
    id: i64,
    name: []const u8,
});

Modules

ModuleDescription
ConnectionDatabase open/close, exec, transactions, schema management
DSLType-safe query builder — table, insert, select, update, delete, joins
SQLRaw SQL execution — lexer, parser, AST, compiler
StorageLow-level storage — file I/O, pager, WAL, journal, image format
CatalogSchema catalog — table definitions, indexes, type affinity

Released under the MIT License.