Skip to main content

TableLike

Trait TableLike 

Source
pub trait TableLike:
    ReadableValueSet
    + WritableValueSet
    + Send
    + Sync {
Show 20 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<(), VantageError>; fn temp_add_condition( &mut self, condition: AnyExpression, ) -> Result<ConditionHandle, VantageError>; fn temp_remove_condition( &mut self, handle: ConditionHandle, ) -> Result<(), VantageError>; fn search_expression( &self, search_value: &str, ) -> Result<AnyExpression, VantageError>; fn clone_box( &self, ) -> Box<dyn TableLike<Id = Self::Id, Value = Self::Value>>; fn into_any(self: Box<Self>) -> Box<dyn Any>; fn as_any_ref(&self) -> &(dyn Any + 'static); 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, VantageError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; // Provided methods fn set_table_name(&mut self, _name: String) { ... } 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<(), VantageError> { ... } fn get_ref(&self, _relation: &str) -> Result<AnyTable, VantageError> { ... }
}
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<(), VantageError>

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, VantageError>

Add a temporary condition using AnyExpression that can be removed later

Source

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

Remove a temporary condition by its handle

Source

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

Create a search expression for this table

Source

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

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 + 'static)

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, VantageError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get count of records in the table

Provided Methods§

Source

fn set_table_name(&mut self, _name: String)

Override the table name. Default is a no-op for backends that don’t honor it; the REST API driver overrides it to swap a canonical endpoint for a per-reference URI template at traversal time.

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<(), VantageError>

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, VantageError>

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 + 'static + Send + Sync, E: Entity<<T as TableSource>::Value> + 'static + Send + Sync,