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 + Sync + Send>,
) -> 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<Value = Self::Value, Id = Self::Id>>;
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§
fn table_name(&self) -> &str
fn table_alias(&self) -> &str
fn column_names(&self) -> Vec<String>
Sourcefn add_condition(
&mut self,
condition: Box<dyn Any + Sync + Send>,
) -> Result<(), VantageError>
fn add_condition( &mut self, condition: Box<dyn Any + Sync + Send>, ) -> 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
Sourcefn temp_add_condition(
&mut self,
condition: AnyExpression,
) -> Result<ConditionHandle, VantageError>
fn temp_add_condition( &mut self, condition: AnyExpression, ) -> Result<ConditionHandle, VantageError>
Add a temporary condition using AnyExpression that can be removed later
Sourcefn temp_remove_condition(
&mut self,
handle: ConditionHandle,
) -> Result<(), VantageError>
fn temp_remove_condition( &mut self, handle: ConditionHandle, ) -> Result<(), VantageError>
Remove a temporary condition by its handle
Sourcefn search_expression(
&self,
search_value: &str,
) -> Result<AnyExpression, VantageError>
fn search_expression( &self, search_value: &str, ) -> Result<AnyExpression, VantageError>
Create a search expression for this table
Sourcefn clone_box(&self) -> Box<dyn TableLike<Value = Self::Value, Id = Self::Id>>
fn clone_box(&self) -> Box<dyn TableLike<Value = Self::Value, Id = Self::Id>>
Clone into a Box for object-safe cloning
fn as_any_ref(&self) -> &(dyn Any + 'static)
Sourcefn set_pagination(&mut self, pagination: Option<Pagination>)
fn set_pagination(&mut self, pagination: Option<Pagination>)
Set pagination for this table
Sourcefn get_pagination(&self) -> Option<&Pagination>
fn get_pagination(&self) -> Option<&Pagination>
Get pagination for this table
Provided Methods§
Sourcefn set_table_name(&mut self, _name: String)
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.
Sourcefn id_field_name(&self) -> Option<String>
fn id_field_name(&self) -> Option<String>
Name of the column flagged as the id field, if any.
Sourcefn title_field_names(&self) -> Vec<String>
fn title_field_names(&self) -> Vec<String>
Names of columns flagged as TitleField.
Sourcefn column_types(&self) -> IndexMap<String, &'static str>
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.
Sourcefn get_ref_names(&self) -> Vec<String>
fn get_ref_names(&self) -> Vec<String>
Names of relations traversable via get_ref.
Sourcefn add_condition_eq(
&mut self,
field: &str,
value: &str,
) -> Result<(), VantageError>
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.
Sourcefn get_ref(&self, _relation: &str) -> Result<AnyTable, VantageError>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".