diff --git a/src/sql.rs b/src/sql.rs index 0a56ada1f..ce31b5995 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -396,7 +396,7 @@ impl Sql { } /// Used for executing `SELECT COUNT` statements only. Returns the resulting count. - pub async fn count(&self, query: &str, params: impl rusqlite::Params) -> anyhow::Result { + pub async fn count(&self, query: &str, params: impl rusqlite::Params) -> Result { let count: isize = self.query_row(query, params, |row| row.get(0)).await?; Ok(usize::try_from(count)?) } @@ -429,10 +429,10 @@ impl Sql { /// /// If the function returns an error, the transaction will be rolled back. If it does not return an /// error, the transaction will be committed. - pub async fn transaction(&self, callback: G) -> anyhow::Result + pub async fn transaction(&self, callback: G) -> Result where H: Send + 'static, - G: Send + 'static + FnOnce(&mut rusqlite::Transaction<'_>) -> anyhow::Result, + G: Send + 'static + FnOnce(&mut rusqlite::Transaction<'_>) -> Result, { let mut conn = self.get_conn().await?; tokio::task::block_in_place(move || { @@ -453,7 +453,7 @@ impl Sql { } /// Query the database if the requested table already exists. - pub async fn table_exists(&self, name: &str) -> anyhow::Result { + pub async fn table_exists(&self, name: &str) -> Result { let conn = self.get_conn().await?; tokio::task::block_in_place(move || { let mut exists = false; @@ -468,7 +468,7 @@ impl Sql { } /// Check if a column exists in a given table. - pub async fn col_exists(&self, table_name: &str, col_name: &str) -> anyhow::Result { + pub async fn col_exists(&self, table_name: &str, col_name: &str) -> Result { let conn = self.get_conn().await?; tokio::task::block_in_place(move || { let mut exists = false; @@ -492,7 +492,7 @@ impl Sql { sql: &str, params: impl rusqlite::Params, f: F, - ) -> anyhow::Result> + ) -> Result> where F: FnOnce(&rusqlite::Row) -> rusqlite::Result, { @@ -516,7 +516,7 @@ impl Sql { &self, query: &str, params: impl rusqlite::Params, - ) -> anyhow::Result> + ) -> Result> where T: rusqlite::types::FromSql, {