pub struct TableDefinition {Show 16 fields
pub name: String,
pub columns: Vec<ColumnDefinition>,
pub indexes: Vec<IndexDefinition>,
pub soft_delete: bool,
pub owner_field: Option<String>,
pub auth_required: bool,
pub permission_area: Option<String>,
pub owner_self_service: bool,
pub hooks: Option<TableHooks>,
pub scoped_by: Option<String>,
pub managed: bool,
pub checks: Vec<CheckConstraint>,
pub search: Option<SearchSpec>,
pub audit_redact: Vec<String>,
pub sensitive: bool,
pub pagination: Pagination,
}Fields§
§name: String§columns: Vec<ColumnDefinition>§indexes: Vec<IndexDefinition>§soft_delete: bool§owner_field: Option<String>Column name that stores the owner’s user ID for row-level security. When set, CRUD operations are scoped to the authenticated user’s records.
auth_required: boolWhen true, all CRUD operations on this table require authentication. Unauthenticated requests receive a 401 Unauthorized response.
permission_area: Option<String>Permission area that controls access to this table’s CRUD operations. When set, platform checks “{area}:view” for GET, “{area}:create” for POST, “{area}:edit” for PUT, “{area}:delete” for DELETE.
owner_self_service: boolSelf-service ownership: when true (requires owner_field), owning a row
authorizes access to it — the row-level scoping by owner_field IS the
authorization, so the permission_area grant is NOT required for these
(inherently owner-scoped) CRUD operations. Use for user-owned data a user
manages themselves (their items, addresses, orders). Defaults false, so
existing tables keep requiring permission_area; cross-owner/staff access
stays gated by RBAC (typically via dedicated handlers, not owner-scoped CRUD).
hooks: Option<TableHooks>CRUD lifecycle hooks — WASM handler names called before/after operations.
scoped_by: Option<String>Scoped permissions: the permission area whose grants’ scopes
(@own, @field(column=claim), @all) select the rows a caller
reaches. Requires owner_field (the @own column); permission_area
defaults to it. Without it the table behaves as before scopes existed.
managed: boolWhether the platform owns the table’s DDL. An unmanaged table exists already: it is validated against the database, never created, altered or dropped.
checks: Vec<CheckConstraint>§search: Option<SearchSpec>What ?search= matches; every text column by pattern when unset.
audit_redact: Vec<String>Columns whose values audit records replace: a name, or prefix*.
sensitive: boolReads of the table are audited as well as writes.
pagination: PaginationImplementations§
Source§impl TableDefinition
impl TableDefinition
Sourcepub fn primary_key(&self) -> Option<&ColumnDefinition>
pub fn primary_key(&self) -> Option<&ColumnDefinition>
Get the primary key column
Sourcepub fn writable_columns(&self) -> Vec<&ColumnDefinition>
pub fn writable_columns(&self) -> Vec<&ColumnDefinition>
Get all non-primary-key, non-auto columns (for INSERT/UPDATE)
Sourcepub fn derived_features(&self) -> impl Iterator<Item = &'static str>
pub fn derived_features(&self) -> impl Iterator<Item = &'static str>
Platform features this table’s declaration requires.