pub struct Table { /* private fields */ }Expand description
A table in a database.
Contains both the metadata and the actual data.
Implementations§
source§impl Table
impl Table
sourcepub fn new_row(&mut self, data: Vec<Value>) -> &mut Self
pub fn new_row(&mut self, data: Vec<Value>) -> &mut Self
Add a new row of data to the table.
Note: validation is not implemented yet and the return type is subject to change.
sourcepub fn name(&self) -> &BoundedString
pub fn name(&self) -> &BoundedString
The table’s name.
sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Number of non-internal columns.
sourcepub fn add_column(&mut self, column: Column) -> &mut Self
pub fn add_column(&mut self, column: Column) -> &mut Self
Add a new column to the table.
Note: this does not yet modify any of the rows. They must be kept consistent
externally using add_column_data.
sourcepub fn add_column_data(
&mut self,
col_name: &BoundedString,
data: Vec<Value>
) -> Result<&mut Self, RuntimeError>
pub fn add_column_data(
&mut self,
col_name: &BoundedString,
data: Vec<Value>
) -> Result<&mut Self, RuntimeError>
Add data for a new column to all rows.
sourcepub fn get_column_data(
&self,
col_name: &BoundedString
) -> Result<Vec<Value>, RuntimeError>
pub fn get_column_data(
&self,
col_name: &BoundedString
) -> Result<Vec<Value>, RuntimeError>
Retrieve all data of a column.
sourcepub fn rename(&mut self, new_name: BoundedString)
pub fn rename(&mut self, new_name: BoundedString)
Rename the table.
sourcepub fn has_no_columns(&self) -> bool
pub fn has_no_columns(&self) -> bool
Whether the table has no defined columns.