From efc10086cbb6726c3728c8edda93b8fd00436717 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 4 Mar 2024 04:40:50 +0300 Subject: Support ?q=category queries Warning, untested. But hopefully works! --- src/database/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/database/mod.rs') diff --git a/src/database/mod.rs b/src/database/mod.rs index b4b70b2..a6a3b46 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -215,6 +215,9 @@ pub type Result = std::result::Result; /// or lock the database so that write conflicts or reading half-written data should not occur. #[async_trait] pub trait Storage: std::fmt::Debug + Clone + Send + Sync { + /// Return the list of categories used in blog posts of a specified blog. + async fn categories(&self, url: &str) -> Result>; + /// Check if a post exists in the database. async fn post_exists(&self, url: &str) -> Result; @@ -236,7 +239,7 @@ pub trait Storage: std::fmt::Debug + Clone + Send + Sync { } /// Remove post from feed. Some database implementations might have optimized ways to do this. #[tracing::instrument(skip(self))] - async fn remove_from_feed(&self, feed: &'_ str, post: &'_ str) -> Result<()> { + async fn remove_from_feed(&self, feed: &str, post: &str) -> Result<()> { tracing::debug!("Removing {} into {} using `update_post`", post, feed); self.update_post(feed, serde_json::from_value( serde_json::json!({"delete": {"children": [post]}})).unwrap() -- cgit 1.4.1