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.
- Enum
Type - A PostgreSQL enum type.
- Error
- A generation error, with the file and line when known.
- Extra
- Any other statement, applied as written.
- Foreign
Key - A
FOREIGN KEYconstraint. - Generated
- The generated files, relative to the output directory.
- Index
- A
CREATE INDEXstatement. - 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
.sqlfiles declare, in a stable order. - Source
File - One input file.
- Table
- A table.
Enums§
- Dependency
- Where rok-db comes from in the generated
Cargo.toml. - Query
Kind - 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 thetypesmodule. - write
- Write the files that changed and remove stale ones. Returns the paths written.