aboutsummaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorJoris2022-01-09 14:50:45 +0100
committerJoris2022-01-09 14:50:45 +0100
commit6c47403b11e7aaf1a22778bdc7615051779cb7bd (patch)
tree66b643ed4032b65e16dffce9182a6a1e46c56e3a /src/db
parentd0a9063631e71928484a698f6c585ebb3915e8a2 (diff)
Allow to delete events
Diffstat (limited to 'src/db')
-rw-r--r--src/db/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/db/mod.rs b/src/db/mod.rs
index 03692e9..0dd4ddf 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -30,6 +30,15 @@ pub fn update(conn: &Connection, event: &Event) -> Result<()> {
Ok(())
}
+pub fn delete(conn: &Connection, id: &Uuid) -> Result<()> {
+ conn.execute(
+ "DELETE FROM events WHERE id = ?",
+ params![id.to_hyphenated().to_string()],
+ )?;
+
+ Ok(())
+}
+
// TODO: Don’t use unwrap
pub fn list(conn: &Connection) -> Result<Vec<Event>> {
let mut stmt = conn.prepare("SELECT id, date, start, end, name FROM events")?;