From 6c47403b11e7aaf1a22778bdc7615051779cb7bd Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 9 Jan 2022 14:50:45 +0100 Subject: Allow to delete events --- src/db/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/db') 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> { let mut stmt = conn.prepare("SELECT id, date, start, end, name FROM events")?; -- cgit v1.2.3