pub struct TableSchema {
pub name: String,
pub columns: HashMap<String, ColumnType>,
pub policies: HashMap<String, String>,
pub foreign_keys: Vec<ForeignKey>,
pub rls_enabled: bool,
pub owner_column: Option<String>,
}Expand description
Table schema information with column types and relations
Fields§
§name: StringTable name.
columns: HashMap<String, ColumnType>Column name → Column type (strongly-typed AST enum)
policies: HashMap<String, String>Column name → Access Policy (Default: “Public”, can be “Protected”)
foreign_keys: Vec<ForeignKey>Foreign key relationships to other tables
rls_enabled: boolWhether this table has Row-Level Security enabled
Auto-detected: table has tenant_id column, an owner <column>
attribute, or explicit rls keyword.
owner_column: Option<String>Owner column for user-scoped isolation (owner <column> table attribute).
Explicit by design: a column named seller_id or user_id is never
inferred as an owner scope. Only this declaration makes
with_rls inject <column> = app.current_user_id.
Implementations§
Source§impl TableSchema
impl TableSchema
Sourcepub fn has_column(&self, name: &str) -> bool
pub fn has_column(&self, name: &str) -> bool
Check if column exists
Sourcepub fn column_type(&self, name: &str) -> Option<&ColumnType>
pub fn column_type(&self, name: &str) -> Option<&ColumnType>
Get column type
Sourcepub fn primary_key_column(&self) -> &str
pub fn primary_key_column(&self) -> &str
Get the primary key column name for this table.
Convention: returns "id" if it exists as a column.
This is a single point of truth for PK resolution — when the schema
parser is enhanced to track PK constraints, update this method.
Trait Implementations§
Source§impl Clone for TableSchema
impl Clone for TableSchema
Source§fn clone(&self) -> TableSchema
fn clone(&self) -> TableSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more