fix: proper Option<i64> query
This commit is contained in:
parent
661b80bcb4
commit
64d53a5f51
1 changed files with 2 additions and 2 deletions
|
@ -224,7 +224,7 @@ impl Database {
|
||||||
|
|
||||||
async fn services(&self) -> rusqlite::Result<Vec<(i64, String)>> {
|
async fn services(&self) -> rusqlite::Result<Vec<(i64, String)>> {
|
||||||
let db = self.0.lock().await;
|
let db = self.0.lock().await;
|
||||||
let mut stmt = db.prepare("SELECT * FROM services")?;
|
let mut stmt = db.prepare("SELECT id, name FROM services")?;
|
||||||
let res = stmt.query_map(
|
let res = stmt.query_map(
|
||||||
params![],
|
params![],
|
||||||
|row| Ok((row.get(0)?, row.get(1)?))
|
|row| Ok((row.get(0)?, row.get(1)?))
|
||||||
|
@ -282,7 +282,7 @@ impl Database {
|
||||||
let mut stmt = db.prepare("SELECT value FROM events WHERE service = :sid AND time > :time")?;
|
let mut stmt = db.prepare("SELECT value FROM events WHERE service = :sid AND time > :time")?;
|
||||||
stmt.query_row(
|
stmt.query_row(
|
||||||
named_params! { ":sid": sid, ":time": since },
|
named_params! { ":sid": sid, ":time": since },
|
||||||
|row| row.get(0).optional()
|
|row| row.get::<usize, Option<i64>>(0)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue