diff --git a/src/db.rs b/src/db.rs index 67d0b36..1a026ff 100644 --- a/src/db.rs +++ b/src/db.rs @@ -229,6 +229,12 @@ fn query_from_sub(sub: &Subscription) -> String { let created_clause = format!("created_at > {}", f.since.unwrap()); filter_components.push(created_clause); } + // Query for timestamp + if f.until.is_some() { + let until_clause = format!("created_at < {}", f.until.unwrap()); + filter_components.push(until_clause); + } + // combine all clauses, and add to filter_clauses if !filter_components.is_empty() { let mut fc = "( ".to_owned(); diff --git a/src/subscription.rs b/src/subscription.rs index c6d6488..092dd50 100644 --- a/src/subscription.rs +++ b/src/subscription.rs @@ -29,6 +29,8 @@ pub struct ReqFilter { pub pubkey: Option, /// Events published after this time pub since: Option, + /// Events published before this time + pub until: Option, /// List of author public keys pub authors: Option>, }