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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Table
impl RefUnwindSafe for Table
impl Send for Table
impl Sync for Table
impl Unpin for Table
impl UnwindSafe for Table
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
Mutably borrows from an owned value. Read more