Generate examples
These pages are snapshot fixtures from packages/sqlfu/test/generate/fixtures/. Each ##
heading you’ll find inside is a real test: the test harness parses the same markdown,
runs sqlfu generate against the declared inputs, and asserts the outputs match what’s
shown. That means every TypeScript file under an output block on these pages is
exactly what you’d find in your checkout after running the CLI — there is no drift.
Start here if you want to see what sqlfu generate produces for a given schema shape,
query style, or config knob, before you try it in your own project.
- Basics — Basic
sqlfu generatesnapshot fixtures. - Config — Fixtures for configuration knobs that shape what
sqlfu generateemits:sync,importExtension, tsconfig-driven.ts-import detection, nested query directories, and the runtime query catalog that drives the form UI. - Errors — Error-case fixtures:
sqlfu generateshould refuse to run and throw a specific message. - Query annotations — Query annotations let one SQL file declare multiple named queries.
- Query shapes — One test per query “shape” the generator recognizes: insert, insert-returning, update, delete, aggregate, user-defined function, and CTE.
- Result types — Result-type inference fixtures: how
sqlfu generatederives column types from the analyzed schema, aliases, view columns,is not nullnarrowing, expression aliases, andlimit 1single-row shape. - Validators — Validator-integration fixtures: zod, valibot, zod/mini, arktype.