Skip to main content

Crate rok_db_codegen

Crate rok_db_codegen 

Source
Expand description

Generate a rok-db crate from .sql files: models and enums from CREATE TABLE / CREATE TYPE, typed functions from sqlc-style annotated queries, and migrations computed from schema changes.

Most people use the rok-db-gen binary; see the crate README.

Structs§

Column
A column.
EnumType
A PostgreSQL enum type.
Error
A generation error, with the file and line when known.
Extra
Any other statement, applied as written.
ForeignKey
A FOREIGN KEY constraint.
Generated
The generated files, relative to the output directory.
Index
A CREATE INDEX statement.
Options
What to generate, and how.
Parsed
The parsed input: the schema and the annotated queries.
Query
An annotated query (-- name: find_by_email :one).
Schema
Everything the .sql files declare, in a stable order.
SourceFile
One input file.
Table
A table.

Enums§

Dependency
Where rok-db comes from in the generated Cargo.toml.
QueryKind
What a query returns.
Rename
A rename the user asked for (--rename), applied before diffing.

Functions§

differences
Files whose content on disk differs from generated (CI check).
generate
Generate everything in memory. Nothing is written.
parse
Parse every file. Files whose stem starts with _ hold shared statements; their enums land in the types module.
write
Write the files that changed and remove stale ones. Returns the paths written.