prax_schema!() { /* proc-macro */ }Expand description
Generate models from a Prax schema file.
This macro reads a .prax schema file at compile time and generates
type-safe Rust code for all models, enums, and types defined in the schema.
§Example
ⓘ
prax::prax_schema!("schema.prax");
// Now you can use the generated types:
let user = client.user().find_unique(user::id::equals(1)).exec().await?;§Generated Code
For each model in the schema, this macro generates:
- A module with the model name (snake_case)
- A
Datastruct representing a row from the database - A
CreateInputstruct for creating new records - A
UpdateInputstruct for updating records - Field modules with filter operations (
equals,contains,in_, etc.) - A
WhereParamenum for type-safe filtering - An
OrderByParamenum for sorting - Select and Include builders for partial queries