created a delete function
This commit is contained in:
parent
1b46f9a604
commit
c06ad54d5b
@ -99,6 +99,13 @@ impl Table {
|
|||||||
self.rewrite_table()?;
|
self.rewrite_table()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn delete_collection(&mut self, name:String) -> Result<(), Box<dyn Error>>{
|
||||||
|
let selected_row = self.get_row(name.clone()).expect("No collection with that name in table");
|
||||||
|
remove_file(&selected_row.path)?;
|
||||||
|
self.collections.remove(&name);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update<T:Serialize>(&mut self, name: String, entry: Collection<T>)-> Result<(), Box<dyn Error>>{
|
pub fn update<T:Serialize>(&mut self, name: String, entry: Collection<T>)-> Result<(), Box<dyn Error>>{
|
||||||
// TODO: this currently wipes out files and rewrites the entirety of them. Update to only change the sections that need to change.
|
// TODO: this currently wipes out files and rewrites the entirety of them. Update to only change the sections that need to change.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user