Skip to main content

TableLike

Trait TableLike 

Source
pub trait TableLike:
    ReadableValueSet
    + WritableValueSet
    + Send
    + Sync {
Show 19 methods // Required methods fn table_name(&self) -> &str; fn table_alias(&self) -> &str; fn column_names(&self) -> Vec<String>; fn add_condition( &mut self, condition: Box<dyn Any + Send + Sync>, ) -> Result<()>; fn temp_add_condition( &mut self, condition: AnyExpression, ) -> Result<ConditionHandle>; fn temp_remove_condition(&mut self, handle: ConditionHandle) -> Result<()>; fn search_expression(&self, search_value: &str) -> Result<AnyExpression>; fn clone_box( &self, ) -> Box<dyn TableLike<Value = Self::Value, Id = Self::Id>>; fn into_any(self: Box<Self>) -> Box<dyn Any>; fn as_any_ref(&self) -> &dyn Any; fn set_pagination(&mut self, pagination: Option<Pagination>); fn get_pagination(&self) -> Option<&Pagination>; fn get_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn id_field_name(&self) -> Option<String> { ... } fn title_field_names(&self) -> Vec<String> { ... } fn column_types(&self) -> IndexMap<String, &'static str> { ... } fn get_ref_names(&self) -> Vec<String> { ... } fn add_condition_eq(&mut self, field: &str, value: &str) -> Result<()> { ... } fn get_ref(&self, _relation: &str) -> Result<AnyTable> { ... }
}
Expand description

Dyn-safe trait for table operations.

Required Methods§

Source

fn table_name(&self) -> &str

Source

fn table_alias(&self) -> &str

Source

fn column_names(&self) -> Vec<String>

Source

fn add_condition(&mut self, condition: Box<dyn Any + Send + Sync>) -> Result<()>

Add a condition to this table using a type-erased expression The expression must be of type T::Expr for the underlying table’s TableSource

Source

fn temp_add_condition( &mut self, condition: AnyExpression, ) -> Result<ConditionHandle>

Add a temporary condition using AnyExpression that can be removed later

Source

fn temp_remove_condition(&mut self, handle: ConditionHandle) -> Result<()>

Remove a temporary condition by its handle

Source

fn search_expression(&self, search_value: &str) -> Result<AnyExpression>

Create a search expression for this table

Source

fn clone_box(&self) -> Box<dyn TableLike<Value = Self::Value, Id = Self::Id>>

Clone into a Box for object-safe cloning

Source

fn into_any(self: Box<Self>) -> Box<dyn Any>

Convert to Any for downcasting

Source

fn as_any_ref(&self) -> &dyn Any

Source

fn set_pagination(&mut self, pagination: Option<Pagination>)

Set pagination for this table

Source

fn get_pagination(&self) -> Option<&Pagination>

Get pagination for this table

Source

fn get_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<i64>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get count of records in the table

Provided Methods§

Source

fn id_field_name(&self) -> Option<String>

Name of the column flagged as the id field, if any.

Source

fn title_field_names(&self) -> Vec<String>

Names of columns flagged as TitleField.

Source

fn column_types(&self) -> IndexMap<String, &'static str>

Map of column name -> original Rust type name. Backends that preserve type metadata (e.g. Column::get_type()) override this so generic UIs can drive type-aware rendering without poking at concrete column types.

Source

fn get_ref_names(&self) -> Vec<String>

Names of relations traversable via [get_ref].

Source

fn add_condition_eq(&mut self, field: &str, value: &str) -> Result<()>

Add a permanent equality condition expressed as raw strings.

Generic CLIs (and other type-erased callers) work with field=value text and cannot reach into T::Condition. Each backend that supports textual eq filtering overrides this; the default returns an error.

Source

fn get_ref(&self, _relation: &str) -> Result<AnyTable>

Traverse a named reference and return the related table as AnyTable.

Default impl returns an error so wrappers without ref support compile unchanged. Table<T, E> overrides this to delegate to its inherent get_ref; AnyTable, CborAdapter and LiveTable override to forward through to the underlying table that holds the refs.

Implementors§

Source§

impl TableLike for AnyTable

Source§

impl<T, E> TableLike for Table<T, E>
where T: TableSource + Send + Sync + 'static, E: Send + Sync + Entity<T::Value> + 'static,