aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/stats.rs
diff options
context:
space:
mode:
authorEllie Huxtable <e@elm.sh>2021-04-25 18:21:52 +0100
committerGitHub <noreply@github.com>2021-04-25 17:21:52 +0000
commit156893d774b4da5b541fdbb08428f9ec392949a0 (patch)
tree9185d94384aa62eb6eb099ddc4ca9408df6f90d1 /src/command/stats.rs
parentAdd to Cargo.toml (diff)
downloadatuin-156893d774b4da5b541fdbb08428f9ec392949a0.zip
Update docs, unify on SQLx, bugfixes (#40)
* Begin moving to sqlx for local too * Stupid scanners should just have a nice cup of tea Random internet shit searching for /.env or whatever * Remove diesel and rusqlite fully
Diffstat (limited to 'src/command/stats.rs')
-rw-r--r--src/command/stats.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/command/stats.rs b/src/command/stats.rs
index 5c9a9dbb..6aa54a2c 100644
--- a/src/command/stats.rs
+++ b/src/command/stats.rs
@@ -71,7 +71,11 @@ fn compute_stats(history: &[History]) -> Result<()> {
}
impl Cmd {
- pub fn run(&self, db: &mut impl Database, settings: &Settings) -> Result<()> {
+ pub async fn run(
+ &self,
+ db: &mut (impl Database + Send + Sync),
+ settings: &Settings,
+ ) -> Result<()> {
match self {
Self::Day { words } => {
let words = if words.is_empty() {
@@ -86,7 +90,7 @@ impl Cmd {
};
let end = start + Duration::days(1);
- let history = db.range(start.into(), end.into())?;
+ let history = db.range(start.into(), end.into()).await?;
compute_stats(&history)?;
@@ -94,7 +98,7 @@ impl Cmd {
}
Self::All => {
- let history = db.list(None, false)?;
+ let history = db.list(None, false).await?;
compute_stats(&history)?;