Skip to main content

Module schema

Module schema 

Source
Expand description

The declarative resource model.

A resource is one models/<name>.toml file. It declares fields and a per-action permission policy; the framework turns it into a Postgres table and a set of RESTful CRUD endpoints. Users, roles and api-keys are ordinary resources that ship with built-in defaults (see crate::defaults).

Structs§

AuthSpec
Auth configuration carried in a [auth] section on the user resource.
Field
One column in a resource.
FieldAdmin
Per-field dashboard presentation, from [fields.<name>.admin].
Hooks
The [hooks] section of a resource: a function name per lifecycle event.
Permissions
Per-action permissions. Strings in TOML are parsed via Access::parse.
Reference
A resolved belongs_to edge: the referencing field, its target resource, and the JSON key it expands under (owner_idowner).
Resource
A fully-parsed resource definition.
ResourceAdmin
The [admin] section of a resource: how it is presented — and to whom — in the generated dashboard.
ResourceMeta

Enums§

Access
Access policy for a single action on a resource.
AuthEvent
One point in an auth endpoint’s lifecycle at which a function may run.
ContentFormat
What kind of content a free-text field holds.
FieldType
Supported column types.
HookEvent
One point in a resource’s request lifecycle at which a function may run.
OnDelete
Referential action applied by a foreign key when the parent row is deleted.
Scope
Whether a resource is isolated per organisation (the default) or shared across the whole deployment.
Widget
The input a field is edited with in the dashboard.

Functions§

is_auth_resource
Whether a resource is one of the built-in auth/tenancy resources, which the dashboard manages through dedicated screens instead of generic CRUD.
pluralize
A deliberately small English pluraliser — enough for the labels apiplant generates, and overridable per resource with [admin] plural.
relation_name
The relation name a reference field expands under: owner_idowner, otherwise the field name unchanged.
titleize
"purchase_order""Purchase order". Sentence case, not title case: a dashboard full of Capitalised Nouns reads like a form, not an application.