pub struct Table {
pub schema: CompactString,
pub name: CompactString,
pub description: Option<String>,
pub is_view: bool,
pub insertable: bool,
pub updatable: bool,
pub deletable: bool,
pub readable: bool,
pub pk_cols: SmallVec<[CompactString; 2]>,
pub columns: Arc<IndexMap<CompactString, Column>>,
pub computed_fields: HashMap<CompactString, ComputedField>,
}Expand description
Table/View metadata
Represents a PostgreSQL table, view, materialized view, or foreign table with its metadata and columns.
Fields§
§schema: CompactStringSchema name
name: CompactStringTable/view name
description: Option<String>Description from pg_description
is_view: boolWhether this is a view (or materialized view)
insertable: boolWhether INSERT is allowed
updatable: boolWhether UPDATE is allowed
deletable: boolWhether DELETE is allowed
readable: boolWhether SELECT is allowed (for current role)
pk_cols: SmallVec<[CompactString; 2]>Primary key column names (sorted)
columns: Arc<IndexMap<CompactString, Column>>Columns indexed by name (preserves insertion order)
computed_fields: HashMap<CompactString, ComputedField>Computed fields available on this table Maps function name -> ComputedField
Implementations§
Source§impl Table
impl Table
Sourcepub fn qi(&self) -> QualifiedIdentifier
pub fn qi(&self) -> QualifiedIdentifier
Get the qualified identifier for this table
Sourcepub fn columns_list(&self) -> impl Iterator<Item = &Column>
pub fn columns_list(&self) -> impl Iterator<Item = &Column>
Iterate over all columns
Sourcepub fn get_column(&self, name: &str) -> Option<&Column>
pub fn get_column(&self, name: &str) -> Option<&Column>
Get a column by name
Sourcepub fn is_pk_column(&self, col_name: &str) -> bool
pub fn is_pk_column(&self, col_name: &str) -> bool
Check if a column is part of the primary key
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Get the number of columns
Sourcepub fn is_read_only(&self) -> bool
pub fn is_read_only(&self) -> bool
Check if the table is read-only (no insert, update, or delete)
Sourcepub fn insertable_columns(&self) -> impl Iterator<Item = &Column>
pub fn insertable_columns(&self) -> impl Iterator<Item = &Column>
Get all insertable columns (non-generated, or with defaults)
Sourcepub fn updatable_columns(&self) -> impl Iterator<Item = &Column>
pub fn updatable_columns(&self) -> impl Iterator<Item = &Column>
Get all updatable columns (non-generated)
Sourcepub fn required_columns(&self) -> impl Iterator<Item = &Column>
pub fn required_columns(&self) -> impl Iterator<Item = &Column>
Get required columns for INSERT (non-nullable, no default, not generated)
Sourcepub fn get_computed_field(&self, name: &str) -> Option<&ComputedField>
pub fn get_computed_field(&self, name: &str) -> Option<&ComputedField>
Get a computed field by function name