created a delete function
This commit is contained in:
parent
1b46f9a604
commit
c06ad54d5b
@ -100,6 +100,13 @@ impl 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.
|
||||||
let selected_row = self.get_row(name).expect("No collection with that name in table.");
|
let selected_row = self.get_row(name).expect("No collection with that name in table.");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user