diff --git a/src/rust/lektor_db/src/connexion.rs b/src/rust/lektor_db/src/connexion.rs index 120f90b0453f029f65fc19baa2db9642ee547db4..6021a8a1d341535e2e0f296adb85d9abdbcfd631 100644 --- a/src/rust/lektor_db/src/connexion.rs +++ b/src/rust/lektor_db/src/connexion.rs @@ -186,12 +186,19 @@ impl LktDatabaseConnection { /// Returns the queue history. pub fn history(&mut self) -> LktDatabaseResult<Vec<i64>> { - todo!() + Ok(with_dsl!(history => history + .select(id) + .order_by(epoch.desc()) + .load::<i64>(&mut self.sqlite)? + )) } /// Clears the history. pub fn clear_history(&mut self) -> LktDatabaseResult<()> { - todo!() + with_dsl! { history => { + diesel::delete(history).execute(&mut self.sqlite)?; + Ok(()) + }} } /// Search the history by URIs. We return the local ids. diff --git a/src/rust/lektor_db/src/types.rs b/src/rust/lektor_db/src/types.rs index 76a9ed736b088298621b9e13e7985ed90510ac7b..45716cfdf585496c7b44f33d112d7d503ed96269 100644 --- a/src/rust/lektor_db/src/types.rs +++ b/src/rust/lektor_db/src/types.rs @@ -1,3 +1,7 @@ +//! Types exported by the database crate. +//! TODO: Use [bumpalo](https://docs.rs/bumpalo/3.12.0/bumpalo/) to reduce +//! allocation counts? + use hashbrown::HashMap; pub struct KaraInfo {