Skip to content
pre-alpha — the TypeScript API may still shift. The SQL won't.

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 generate snapshot fixtures.
  • Config — Fixtures for configuration knobs that shape what sqlfu generate emits: 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 generate should 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 generate derives column types from the analyzed schema, aliases, view columns, is not null narrowing, expression aliases, and limit 1 single-row shape.
  • Validators — Validator-integration fixtures: zod, valibot, zod/mini, arktype.