pub struct Table {
pub name: String,
pub columns: Vec<Column>,
/* private fields */
}Fields§
§name: String§columns: Vec<Column>Implementations§
Source§impl Table
impl Table
pub fn new(name: &str, columns: Vec<Column>) -> Result<Table, DbError>
pub fn row_count(&self) -> usize
pub fn column_index(&self, name: &str) -> Result<usize, DbError>
pub fn coerce_val(&self, val: &Value, col_idx: usize) -> Result<Value, DbError>
Sourcepub fn insert_row(&mut self, values: Vec<Value>) -> Result<u64, DbError>
pub fn insert_row(&mut self, values: Vec<Value>) -> Result<u64, DbError>
Insert a fully-validated row value vector; maintains indexes.
Sourcepub fn delete_row(&mut self, rid: u64) -> Result<(), DbError>
pub fn delete_row(&mut self, rid: u64) -> Result<(), DbError>
Remove a row by id; also removes its index entries.
Sourcepub fn scan(&self) -> impl Iterator<Item = (u64, &Row)>
pub fn scan(&self) -> impl Iterator<Item = (u64, &Row)>
Iterate (rid, row) over live slots in slot order.
Sourcepub fn replace_row(&mut self, rid: u64, new: Vec<Value>) -> Result<(), DbError>
pub fn replace_row(&mut self, rid: u64, new: Vec<Value>) -> Result<(), DbError>
Replace a row’s values in place, removing old index entries and inserting new ones. Caller is responsible for constraint validation.
Sourcepub fn rebuild_indexes(&mut self)
pub fn rebuild_indexes(&mut self)
Lazy rebuild of unique/pk indexes — used when row store is bulk-loaded or after operations that bypass per-row index maintenance.
pub fn has_pk(&self, v: &Value) -> bool
pub fn unique_tree(&self, col_idx: usize) -> Option<&BTree>
pub fn create_index( &mut self, name: &str, column: usize, unique: bool, ) -> Result<(), DbError>
pub fn drop_index(&mut self, name: &str) -> bool
pub fn has_index(&self, name: &str) -> bool
pub fn index(&self, column: usize) -> Option<&Index>
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 UnsafeUnpin 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