Skip to main content

TableLike

Trait TableLike 

Source
pub trait TableLike:
    ReadableValueSet
    + WritableValueSet
    + Send
    + Sync {
Show 14 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 method 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 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,