From ea34fb1b99765a52da5c881c7cc14b1fd30a5c89 Mon Sep 17 00:00:00 2001 From: jakka Date: Mon, 29 Sep 2025 18:13:20 +0300 Subject: rewrote everything in async. waiting for turso to support actual sql features --- src/db.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/db.rs') diff --git a/src/db.rs b/src/db.rs index 420fdb7..a899ac3 100644 --- a/src/db.rs +++ b/src/db.rs @@ -19,7 +19,7 @@ const DEDUPE_DB: &str = "DELETE FROM flacs WHERE rowid NOT IN (SELECT MAX(rowid) FROM flacs GROUP BY path)"; const GET_MODTIME: &str = "SELECT modtime FROM flacs WHERE path = ?1"; -pub(crate) async fn init_db(path: Option<&Path>) -> Result { +pub(crate) async fn init_db(path: Option<&PathBuf>) -> Result { let db = if let Some(file) = path { turso::Builder::new_local(file.to_str().unwrap()) .build() @@ -111,13 +111,12 @@ pub(crate) async fn get_toencode_files(conn: &Connection) -> Result } pub(crate) async fn get_toencode_number(conn: &Connection) -> Result { - Ok(conn - .query(TOENCODE_NUMBER, ()) + conn.query(TOENCODE_NUMBER, ()) .await? .next() .await? .unwrap() - .get::(0)?) + .get::(0) } pub(crate) async fn get_modtime(conn: &Connection, file: &Path) -> Result { @@ -213,6 +212,7 @@ mod tests { } std::fs::remove_file(dbname).unwrap(); assert!(counter == 0) - }); + }) + .await; } } -- cgit v1.3.1