queriesgen

command
v13.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Command queriesgen writes the canonical sqlc input for the work queue schema, one file per dialect it serves, from workqueue/internal/queries.

It is run by `make generate`, and the file it writes is checked in. Nothing imports it and nothing executes it: it exists so that `sqlc compile` can check the statements the queue executes against the schema workqueue/migrations renders, at build time, with no database running. What the queue executes is the querier sqlc-gen-unison generates from that same file — the same text with the consumer's table prefix substituted for {{prefix}} and the argument references rewritten into bind markers.

One dialect, because workqueue serves one. The loop is still a loop over Dialects, so the roster is a list rather than a decision written into the control flow — a second dialect would be a schema and a line, not a rewrite.

Because the check is what the file is for, this command also renders the other half of it: `-schema <dialect>` prints the DDL sqlc reads it against, so .scripts/sqlc_compile.sh has no hand-written copy of a schema to keep in step with workqueue/migrations. `make unison` calls it that way before running the emitter over the pair.

go run ./internal/queriesgen                   # writes internal/queries/<dialect>_generated.sql
go run ./internal/queriesgen -schema postgres  # prints the DDL to stdout

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL