diff options
author | Ricky Kresslein <rk@lakoliu.com> | 2022-05-20 12:26:53 +0300 |
---|---|---|
committer | Ricky Kresslein <rk@lakoliu.com> | 2022-05-20 12:26:53 +0300 |
commit | 3942e6cab7a0883220d78068dc47ddf81760a90e (patch) | |
tree | d8ea83980739befb888ca827d6a9952fc4e9d478 /src/database.rs | |
parent | 1dd125d02f5d66643e39fe2da636d036ed733904 (diff) | |
download | Furtherance-3942e6cab7a0883220d78068dc47ddf81760a90e.tar.zst |
Autosave (Issue #45)
Diffstat (limited to 'src/database.rs')
-rwxr-xr-x | src/database.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/database.rs b/src/database.rs index 5412896..69b56dc 100755 --- a/src/database.rs +++ b/src/database.rs @@ -81,6 +81,21 @@ pub fn db_write(task_name: &str, Ok(()) } +pub fn write_autosave(task_name: &str, + start_time: &str, + stop_time: &str, + tags: &str) -> Result<()> { + // Write data into database + let conn = Connection::open(get_directory())?; + + conn.execute( + "INSERT INTO tasks (task_name, start_time, stop_time, tags) values (?1, ?2, ?3, ?4)", + &[&task_name, &start_time, &stop_time, &tags], + )?; + + Ok(()) +} + pub fn retrieve() -> Result<Vec<Task>, rusqlite::Error> { // Retrieve all tasks from the database let conn = Connection::open(get_directory())?; |