Skip to main content

TableSchemaProvider

Trait TableSchemaProvider 

Source
pub trait TableSchemaProvider:
    Copy
    + Into<Table>
    + 'static {
    // Required methods
    fn all() -> &'static [Self];
    fn create_statement(&self) -> String;
    fn name(&self) -> &'static str;
    fn populate<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = ApiResult<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn print(self, path: Option<PathBuf>);
    fn rows<R, P>(
        &self,
        query: &str,
        params: P,
        path: Option<&PathBuf>,
    ) -> ApiResult<Vec<R>>
       where P: Params,
             for<'row> R: Row + From<&'row BackendRow<'row>>;
}
Expand description

Table schema provider for database operations

Required Methods§

Source

fn all() -> &'static [Self]

Returns all variants for the table type.

Source

fn create_statement(&self) -> String

Returns the CREATE TABLE SQL statement for this table

Source

fn name(&self) -> &'static str

Returns the table name as a string

Source

fn populate<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ApiResult<usize>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Populate the table with data (typically downloaded use API module)

Source

fn print(self, path: Option<PathBuf>)

Print all table rows

Source

fn rows<R, P>( &self, query: &str, params: P, path: Option<&PathBuf>, ) -> ApiResult<Vec<R>>
where P: Params, for<'row> R: Row + From<&'row BackendRow<'row>>,

Get table rows

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§