StoreMut¶
StoreMut writes schemas and rows for CREATE TABLE, INSERT, UPDATE, DELETE, and DROP TABLE. Override the methods your storage supports. The defaults return unsupported errors, which a read-only adapter can keep.
It provides five methods:
-
insert_schema: This method is responsible for inserting a new schema into the storage system. -
delete_schema: This method is for deleting a schema from the storage system using the provided table name. -
append_data: This method appends a list of data rows to an existing table in the storage system. -
insert_data: This method inserts a list of key-data row pairs into an existing table in the storage system. -
delete_data: This method deletes a list of keys and their corresponding data rows from an existing table in the storage system.
/// By implementing `StoreMut` trait,
/// you can run `INSERT`, `CREATE TABLE`, `DELETE`, `UPDATE` and `DROP TABLE` queries.
pub trait StoreMut {
fn insert_schema(&mut self, schema: &Schema) -> Result<()>;
fn delete_schema(&mut self, table_name: &str) -> Result<()>;
fn append_data(&mut self, table_name: &str, rows: Vec<Vec<Value>>) -> Result<()>;
fn insert_data(&mut self, table_name: &str, rows: Vec<(Key, Vec<Value>)>) -> Result<()>;
fn delete_data(&mut self, table_name: &str, keys: Vec<Key>) -> Result<()>;
}