From 70ef6e0e8e825c1c22be48a0ee7f6d20e2c29a2a Mon Sep 17 00:00:00 2001 From: alemi Date: Tue, 3 Dec 2024 01:24:12 +0100 Subject: [PATCH] fix: limit is no longer optional --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 4c11962..23ee484 100644 --- a/src/main.rs +++ b/src/main.rs @@ -173,7 +173,7 @@ async fn api_status_service( ) -> ApiResult)>> { let limit = q.limit.unwrap_or(50).min(250); let sid = db.sid(&service, false).await?; - Ok(Json(db.get(sid, Some(limit)).await?)) + Ok(Json(db.get(sid, limit).await?)) } @@ -241,12 +241,12 @@ impl Database { Ok(()) } - async fn get(&self, sid: i64, limit: Option) -> rusqlite::Result> { + async fn get(&self, sid: i64, limit: i64) -> rusqlite::Result> { let db = self.0.lock().await; let mut stmt = db.prepare("SELECT time, value FROM events WHERE service = :sid LIMIT :limit")?; let results = stmt.query_map( named_params! { ":sid": sid, ":limit": limit }, - |row| Ok((row.get(0)?, row.get(1).optional()?)), + |row| Ok((row.get(0)?, row.get(1)?)), )?; Ok(