From b94753e4e81a54763f66ce9f4573855c9dee6b2a Mon Sep 17 00:00:00 2001 From: Laurent Doguin Date: Mon, 3 Nov 2025 18:19:22 +0100 Subject: [PATCH] add a Timestamp getter to make the expiration date available --- src/lib.rs | 4 ++++ tests/document_tests.rs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index a6b10f7..19786ae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -103,6 +103,10 @@ impl Timestamp { timestamp: self.timestamp + duration.as_millis() as i64, } } + + pub fn get(&self) -> i64 { + self.timestamp + } } pub struct Listener { diff --git a/tests/document_tests.rs b/tests/document_tests.rs index 54ea332..e74ca91 100644 --- a/tests/document_tests.rs +++ b/tests/document_tests.rs @@ -367,6 +367,9 @@ fn database_document_expiration() { .expect("document_expiration"); assert_eq!(doc_expiration.unwrap(), expiration); + let set_expiration = doc_expiration.unwrap().get(); + assert_eq!(set_expiration, expiration.get()); + // Check the document is still present after 1 second sleep(Duration::from_secs(1)); assert!(default_collection(db).get_document("foo").is_ok());