Capabilities
Each capability lists the API that provides it and the MPA rules that
define it. The same list is in docs/mpa.json for tools.
| Capability | What it does | API | Rules |
|---|---|---|---|
| typed-views | Declare the shape of nested data with Rust structs deriving View | #[derive(View)]#[view(table, key)] | MPA-CORE-1, MPA-VIEW-1 |
| batched-loading | Load a view with one batched query per relationship, never one per row | mabat::load | MPA-PLAN-1 |
| multiple-databases | PostgreSQL, MySQL 8+ and SQLite, chosen by features and by the connection | features: postgres, mysql, sqlite#[view(databases)] | MPA-DB-1, MPA-DB-2 |
| embedded-values | Structs stored in columns of the containing view, generic or not | #[view(embedded)]#[view(embed(prefix))]mabat::GenericColumn | MPA-VIEW-3, MPA-VIEW-4, MPA-VIEW-7 |
| enums-with-data | Rust enums with data, stored in columns or in a table per variant, decoded strictly | #[view(tag, strategy, lenient)]#[view(tag_value)] | MPA-SUM-1, MPA-SUM-2, MPA-SUM-3, MPA-SUM-4 |
| json-columns | Columns decoded and written as JSON with serde | #[view(json)] | MPA-VIEW-6 |
| to-one-references | References to other views by foreign key, owned, boxed, shared or into a graph | #[view(to_one(fk))]Box<T> | MPA-VIEW-8 |
| collections | To-many collections, ordered, placed by index, or as maps | #[view(child(fk, order_by, index, key))] | MPA-VIEW-9, MPA-VIEW-10 |
| many-to-many | Collections through a link table | #[view(child(through, target))] | MPA-VIEW-9 |
| recursive-views | Trees and chains of parents by depth-limited levels or one WITH RECURSIVE query | #[view(child(depth))]#[view(child(recursive = "cte"))]#[view(to_one(depth))]#[view(to_one(recursive = "cte"))] | MPA-PLAN-4, MPA-LOAD-12, MPA-VIEW-8 |
| shared-values | Arc | Arc<T> | MPA-LOAD-13 |
| graphs | Cyclic data as a Graph of entities with typed references | Ref<T>Load::graphGraph | MPA-LOAD-14 |
| filters-and-paging | Filters, ordering, paging and counting of the root rows | mabat::filter::colLoad::filterLoad::order_byLoad::limitLoad::offsetLoad::count | MPA-LOAD-4, MPA-LOAD-5, MPA-LOAD-6 |
| nested-arguments | Filter, order and page the elements of a collection per parent, in one query | Load::nestedNested | MPA-LOAD-9, MPA-LOAD-10 |
| streaming | Load many values a batch at a time, as a stream, holding one batch in memory | Load::streamLoad::json_streamLoad::batch_size | MPA-LOAD-15, MPA-LOAD-16, MPA-LOAD-17, MPA-LOAD-18 |
| concurrent-loads | Run the queries of each level concurrently on a pool, optionally in one snapshot | Pooled::snapshotPooled::read_committed | MPA-LOAD-11 |
| sql-overrides | Replace any query of a view with tuned SQL from a file, checked at startup | Mabat::builderoverrides_diroverrides_sql-- mabat: query <name> | MPA-OVR-1, MPA-OVR-2, MPA-OVR-3, MPA-OVR-4, MPA-OVR-5 |
| shadow-mode | Run an override next to the generated query and log differences | shadowMabat::shadow_stats | MPA-OVR-6 |
| override-reload | Reload override files without restarting | Mabat::reload | MPA-OVR-7 |
| schema-snapshots | A snapshot of the database’s schema, its drift, and views checked against it without a database | mabat schemamabat::schema::snapshotmabat check --snapshotManifest::check_snapshotmabat_check::build | MPA-SCH-1, MPA-SCH-2, MPA-SCH-3, MPA-SCH-4, MPA-SCH-5, MPA-SCH-6, MPA-SCH-7 |
| dba-tooling | A manifest of the views and the mabat command line tool: check, explain, scaffold | Builder::manifestmabat checkmabat explainmabat scaffold | MPA-OVR-8 |
| report-queries | Reports: root SQL with named parameters and computed fields | Load::sqlLoad::bind#[view(computed)] | MPA-LOAD-19, MPA-VIEW-13, MPA-OVR-3 |
| tracing | tracing spans for each operation, query and statement, with names, rows and times | tracingRUST_LOG=mabat=debug | MPA-DB-6 |
| json-loading | Load views as JSON, whole or a selection of their fields | Load::jsonLoad::selectSelection::parseLoad::graph_json | MPA-JSON-1, MPA-JSON-3, MPA-JSON-4, MPA-JSON-5, MPA-JSON-7 |
| graphql | A GraphQL schema generated from views, each root field one load | mabat_graphql::schema | MPA-GQL-1, MPA-GQL-2, MPA-GQL-3, MPA-GQL-4 |
| save-aggregates | Save a value and everything it owns, creating or replacing rows by key | mabat::save | MPA-WRITE-1, MPA-WRITE-3, MPA-WRITE-4, MPA-WRITE-5, MPA-WRITE-6 |
| save-changes | Save only what changed between two values of an aggregate | mabat::save_changes | MPA-WRITE-8 |
| optimistic-locking | Version columns that make stale writes fail | #[view(version)]Error::Conflict | MPA-WRITE-9, MPA-WRITE-10 |
| save-many | Save many values with statements per table and level, not per row | mabat::save_all | MPA-WRITE-19 |
| save-graphs | Save every entity of a graph, ordered by its references, cycles included | mabat::save_graphGraph::newGraph::insert | MPA-WRITE-14, MPA-WRITE-15, MPA-WRITE-16, MPA-WRITE-17, MPA-WRITE-18 |
| save-graph-changes | Save only the entities of a graph that were inserted or handed out by get_mut | mabat::save_graph_changesGraph::is_changed | MPA-WRITE-20 |
| generated-keys | Keys generated by the database on insert, written back into the value | #[view(generated)]mabat::save | MPA-WRITE-13, MPA-WRITE-10 |
| delete-aggregates | Delete a value and everything it owns | mabat::delete | MPA-WRITE-7 |
Not supported
Section titled “Not supported”- MPA-NOT-3 A unit of work that collects writes and flushes them later (MPA-WRITE-1).
- MPA-NOT-4 Lazy loading: everything a view declares is loaded by the load, or selected (section 8).
- MPA-NOT-5 Writes through overrides, and override SQL for writes.
- MPA-NOT-6 Filtering by columns of embedded structs in
filter,nestedor GraphQLwhere. - MPA-NOT-7 Arguments on map collections in GraphQL, and GraphQL mutations.
- MPA-NOT-8 Pipelining queries on one connection.
- MPA-NOT-9 Schema generation or migrations: views describe existing tables.