Expand description
Schema definitions spanning the app layer, database layer, and the mapping between them. Schema representation for Toasty, split into three layers.
- [
app] – Model-level definitions: fields, relations, constraints. This is what the generated Rust code sees. - [
db] – Table/column-level definitions. This is what the database sees. - [
mapping] – Connects app fields to database columns, supporting non-1:1 mappings such as embedded structs and enums.
The top-level Schema struct ties all three layers together and is
constructed via [Builder].
§Examples
ⓘ
use toasty_core::schema::{Schema, Builder};
let schema = Builder::new()
.build(app_schema, &driver_capability)
.expect("schema should be valid");
// Look up the database table backing a model
let table = schema.table_for(model_id);Modules§
- app
- Application-level (model-oriented) schema definitions. Application-level schema definitions for models, fields, relations, and indices.
- db
- Database-level (table/column-oriented) schema definitions. Database-level schema definitions.
- mapping
- Mapping between the app layer and the database layer. Mapping between app-level models and database-level tables.