pub struct TableDefinition {
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>,
}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.
Implementations§
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)
Trait Implementations§
Source§impl Clone for TableDefinition
impl Clone for TableDefinition
Source§fn clone(&self) -> TableDefinition
fn clone(&self) -> TableDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more