about summary refs log tree commit diff
path: root/src/database/mod.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2024-03-04 04:40:50 +0300
committerVika <vika@fireburn.ru>2024-03-04 04:40:50 +0300
commitefc10086cbb6726c3728c8edda93b8fd00436717 (patch)
tree749437e3a12181e5380a59e32b16fdbf78e87ba9 /src/database/mod.rs
parentb7f0140dc05e4b33352e0ea46db4b36c6bfb2894 (diff)
Support ?q=category queries
Warning, untested. But hopefully works!
Diffstat (limited to 'src/database/mod.rs')
-rw-r--r--src/database/mod.rs5
1 files changed, 4 insertions, 1 deletions
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<T> = std::result::Result<T, StorageError>;
 /// 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<Vec<String>>;
+
     /// Check if a post exists in the database.
     async fn post_exists(&self, url: &str) -> Result<bool>;
 
@@ -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()