Query recipes
Use these focused paths when you already understand installation and snapshot generation. Examples are labeled by scope so an inline proof is not mistaken for a runnable application.
| Level | Scope | Verification |
|---|---|---|
| Inline proof | A small query or API boundary inside a focused guide | Backed by a package or documentation contract when it claims exact output |
| Recipe | One task with schema assumptions, compiler contract, rendered driver input, dialect notes, and source | Compiled fixture plus focused runtime assertions |
| Runnable application | Schema, config, generated evidence, adapter lifecycle, and broader capabilities | Service-free tests and a real-database suite |
Construct queries
| Task | Example | What it proves |
|---|---|---|
| Select with typed parameters | Your first query | Selected row fields and ordered parameters |
| Add optional filters or columns | Conditional composition | Explicit structural branches and result shape |
Insert several rows from Array.map | Multi-row insert recipe | Automatic comma separation, compiler evidence, and five rows of ordered parameters |
Choose mapped arrays or sql.join() | Explicit list controls | Empty, dynamic, or custom-separator behavior |
| Escape static analysis deliberately | Dynamic SQL | Explicit Query<unknown> boundary |
Execute queries
| Task | Example | What it proves |
|---|---|---|
| Execute and assert cardinality | Execution | all, one, maybeOne, cancellation, and deadlines |
| Use an existing pool | Existing pools | Application lifecycle remains application-owned |
| Prepare repeated query shapes | Prepared queries | Stable skeleton and bounded cardinality variants |
| Run an ordered batch | Batches | One lease, ordered results, and non-atomic default |
| Stream a large result | Streaming | Backpressure and explicit cleanup |
| Validate decoded rows | Result validation | Standard Schema checks after driver decoding |
Move data and operate safely
| Task | Example | What it proves |
|---|---|---|
| Choose multi-row SQL, batch, or native bulk | Bulk data | Different semantics and protocol capabilities |
| Trace query lifecycle | Observability | Neutral events, redaction, and OpenTelemetry |
| Route reads and retry transactions | Routing and retries | Semantic routing and bounded retry policy |
| Combine PostgreSQL and SQLite | Multi-database application | Separate grammar, config, evidence, and driver boundaries |
Complete applications
For setup, generated evidence, runtime behavior, and database-backed tests in one place, use the PostgreSQL, MySQL, SQLite, or PostgreSQL plus SQLite application.
The source applications are exercised by the repository's example and real-database test gates. The pages link to their exact source files rather than presenting generated schema output as an application-facing API.