pub struct DataTable {
pub name: String,
pub columns: Vec<DataColumn>,
pub rows: Vec<DataRow>,
pub metadata: HashMap<String, String>,
}
Expand description
The main DataTable
structure
Fields§
§name: String
§columns: Vec<DataColumn>
§rows: Vec<DataRow>
§metadata: HashMap<String, String>
Implementations§
Source§impl DataTable
impl DataTable
pub fn new(name: impl Into<String>) -> Self
Sourcepub fn dual() -> Self
pub fn dual() -> Self
Create a DUAL table (similar to Oracle’s DUAL) with one row and one column Used for evaluating expressions without a data source
pub fn add_column(&mut self, column: DataColumn) -> &mut Self
pub fn add_row(&mut self, row: DataRow) -> Result<(), String>
pub fn get_column(&self, name: &str) -> Option<&DataColumn>
pub fn get_column_index(&self, name: &str) -> Option<usize>
pub fn column_count(&self) -> usize
pub fn row_count(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn column_names(&self) -> Vec<String>
pub fn column_names(&self) -> Vec<String>
Get column names as a vector
Sourcepub fn infer_column_types(&mut self)
pub fn infer_column_types(&mut self)
Infer and update column types based on data
Sourcepub fn get_value(&self, row: usize, col: usize) -> Option<&DataValue>
pub fn get_value(&self, row: usize, col: usize) -> Option<&DataValue>
Get a value at specific row and column
Sourcepub fn get_value_by_name(
&self,
row: usize,
col_name: &str,
) -> Option<&DataValue>
pub fn get_value_by_name( &self, row: usize, col_name: &str, ) -> Option<&DataValue>
Get a value by row index and column name
Sourcepub fn to_string_table(&self) -> Vec<Vec<String>>
pub fn to_string_table(&self) -> Vec<Vec<String>>
Convert to a vector of string vectors (for display/compatibility)
Sourcepub fn get_stats(&self) -> DataTableStats
pub fn get_stats(&self) -> DataTableStats
Get table statistics
Sourcepub fn debug_dump(&self) -> String
pub fn debug_dump(&self) -> String
Generate a debug dump string for display
pub fn estimate_memory_size(&self) -> usize
Sourcepub fn from_query_response(
response: &QueryResponse,
table_name: &str,
) -> Result<Self, String>
pub fn from_query_response( response: &QueryResponse, table_name: &str, ) -> Result<Self, String>
V46: Create DataTable
from QueryResponse
This is the key conversion function that bridges old and new systems
Sourcepub fn get_row_as_strings(&self, index: usize) -> Option<Vec<String>>
pub fn get_row_as_strings(&self, index: usize) -> Option<Vec<String>>
V50: Get a single row as strings
Sourcepub fn pretty_print(&self) -> String
pub fn pretty_print(&self) -> String
Pretty print the DataTable
with a nice box drawing
Sourcepub fn get_schema_summary(&self) -> String
pub fn get_schema_summary(&self) -> String
Get a schema summary of the DataTable
Sourcepub fn get_schema_info(&self) -> Vec<(String, String, bool, usize)>
pub fn get_schema_info(&self) -> Vec<(String, String, bool, usize)>
Get detailed schema information as a structured format
Sourcepub fn reserve_rows(&mut self, additional: usize)
pub fn reserve_rows(&mut self, additional: usize)
Reserve capacity for rows to avoid reallocations
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Shrink vectors to fit actual data (removes excess capacity)
Sourcepub fn get_memory_usage(&self) -> usize
pub fn get_memory_usage(&self) -> usize
Get actual memory usage estimate (more accurate than estimate_memory_size
)
Trait Implementations§
Source§impl DataProvider for DataTable
Implementation of DataProvider
for DataTable
This allows DataTable
to be used wherever DataProvider
trait is expected
impl DataProvider for DataTable
Implementation of DataProvider
for DataTable
This allows DataTable
to be used wherever DataProvider
trait is expected
Source§fn get_row(&self, index: usize) -> Option<Vec<String>>
fn get_row(&self, index: usize) -> Option<Vec<String>>
Source§fn get_column_names(&self) -> Vec<String>
fn get_column_names(&self) -> Vec<String>
Source§fn get_row_count(&self) -> usize
fn get_row_count(&self) -> usize
Source§fn get_column_count(&self) -> usize
fn get_column_count(&self) -> usize
Source§fn get_visible_rows(&self, start: usize, count: usize) -> Vec<Vec<String>>
fn get_visible_rows(&self, start: usize, count: usize) -> Vec<Vec<String>>
get_row
callsSource§fn get_column_widths(&self) -> Vec<usize>
fn get_column_widths(&self) -> Vec<usize>
Source§fn get_cell_value(&self, row: usize, col: usize) -> Option<String>
fn get_cell_value(&self, row: usize, col: usize) -> Option<String>
Source§fn get_display_value(&self, row: usize, col: usize) -> String
fn get_display_value(&self, row: usize, col: usize) -> String
Source§fn get_column_type(&self, _column_index: usize) -> DataType
fn get_column_type(&self, _column_index: usize) -> DataType
Source§fn get_column_types(&self) -> Vec<DataType>
fn get_column_types(&self) -> Vec<DataType>
Auto Trait Implementations§
impl Freeze for DataTable
impl RefUnwindSafe for DataTable
impl Send for DataTable
impl Sync for DataTable
impl Unpin for DataTable
impl UnwindSafe for DataTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more