diff options
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/incomes.rs | 6 | ||||
-rw-r--r-- | src/db/utils.rs | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/db/incomes.rs b/src/db/incomes.rs index 90282c0..688e9e1 100644 --- a/src/db/incomes.rs +++ b/src/db/incomes.rs @@ -373,8 +373,8 @@ fn cumulative_query(from: NaiveDate) -> String { ON users.id = incomes.user_id "#, - bounded_query(">".to_string(), from.format("%Y-%m-%d").to_string()), - bounded_query("<".to_string(), "date()".to_string()) + bounded_query(">", &from.format("%Y-%m-%d").to_string()), + bounded_query("<", "date()") ) } @@ -382,7 +382,7 @@ fn cumulative_query(from: NaiveDate) -> String { /// /// It filters incomes according to the operator and date, /// and adds the income at this date. -fn bounded_query(op: String, date: String) -> String { +fn bounded_query(op: &str, date: &str) -> String { format!( r#" SELECT diff --git a/src/db/utils.rs b/src/db/utils.rs index 30f25c9..bd4d867 100644 --- a/src/db/utils.rs +++ b/src/db/utils.rs @@ -2,7 +2,9 @@ use crate::model::report::Report; use tokio_rusqlite::{Connection, Row}; pub async fn support_foreign_keys(conn: &Connection) { - let res = conn.call(move |conn| Ok(conn.pragma_update(None, "foreign_keys", "ON"))).await; + let res = conn + .call(move |conn| Ok(conn.pragma_update(None, "foreign_keys", "ON"))) + .await; if let Err(err) = res { log::error!("Error supporting foreign keys: {err:?}"); |