DataSource

Trait DataSource 

Source
pub trait DataSource: Send + Sync {
    // Required methods
    fn query(&self, sql: &str) -> Result<DataSourceQueryResponse>;
    fn query_with_options(
        &self,
        sql: &str,
        case_insensitive: bool,
    ) -> Result<DataSourceQueryResponse>;
    fn get_schema(&self) -> Option<HashMap<String, Vec<String>>>;
    fn get_table_name(&self) -> String;
    fn get_row_count(&self) -> usize;
    fn is_case_insensitive(&self) -> bool;
    fn set_case_insensitive(&mut self, case_insensitive: bool);
    fn clone_box(&self) -> Box<dyn DataSource>;
}
Expand description

Trait for abstracting data sources (CSV, JSON, Database, etc.) This allows the TUI to work with data without knowing the specific source

Required Methods§

Source

fn query(&self, sql: &str) -> Result<DataSourceQueryResponse>

Execute a SQL-like query against the data source

Source

fn query_with_options( &self, sql: &str, case_insensitive: bool, ) -> Result<DataSourceQueryResponse>

Execute a query with case-insensitive matching

Source

fn get_schema(&self) -> Option<HashMap<String, Vec<String>>>

Get the schema (table names and their columns)

Source

fn get_table_name(&self) -> String

Get the primary table name

Source

fn get_row_count(&self) -> usize

Get total row count (unfiltered)

Source

fn is_case_insensitive(&self) -> bool

Check if data source is case-insensitive

Source

fn set_case_insensitive(&mut self, case_insensitive: bool)

Set case sensitivity

Source

fn clone_box(&self) -> Box<dyn DataSource>

Clone the data source into a boxed trait object

Implementors§