Skip to main content

render_models

Function render_models 

Source
pub fn render_models(schema: &IntrospectedSchema) -> String
Expand description

Render the introspected schema as the contents of a models.rs file. The output is one #[derive(Model)] struct per table, with fields in declaration order and the #[umbral(table = "…")] attribute set when the struct name differs from the SQL table.

Structs are emitted in alphabetical order by struct name so a re-run against an unchanged schema produces a byte-identical file. Field-type rendering uses fully-qualified chrono::* / uuid::* paths so no extra use lines are needed at the top of the file.