pub struct QueryContext {
pub start: Option<i64>,
pub end: Option<i64>,
pub selected_handle_ids: Option<BTreeSet<i32>>,
pub selected_chat_ids: Option<BTreeSet<i32>>,
}Expand description
Filters applied to message count and stream queries.
Fields§
§start: Option<i64>Inclusive lower-bound timestamp for message dates.
end: Option<i64>Inclusive upper-bound timestamp for message dates.
selected_handle_ids: Option<BTreeSet<i32>>Handle row IDs included in the query.
selected_chat_ids: Option<BTreeSet<i32>>Chat row IDs included in the query.
Implementations§
Source§impl QueryContext
impl QueryContext
Sourcepub fn set_start(&mut self, start: &str) -> Result<(), QueryContextError>
pub fn set_start(&mut self, start: &str) -> Result<(), QueryContextError>
Set the inclusive lower-bound date from YYYY-MM-DD.
§Example:
use imessage_database::util::query_context::QueryContext;
let mut context = QueryContext::default();
context.set_start("2023-01-01");Sourcepub fn set_end(&mut self, end: &str) -> Result<(), QueryContextError>
pub fn set_end(&mut self, end: &str) -> Result<(), QueryContextError>
Set the inclusive upper-bound date from YYYY-MM-DD.
§Example:
use imessage_database::util::query_context::QueryContext;
let mut context = QueryContext::default();
context.set_end("2023-01-01");Sourcepub fn set_selected_handle_ids(&mut self, selected_handle_ids: BTreeSet<i32>)
pub fn set_selected_handle_ids(&mut self, selected_handle_ids: BTreeSet<i32>)
Set the handle row IDs included in the query.
§Example:
use std::collections::BTreeSet;
use imessage_database::util::query_context::QueryContext;
let mut context = QueryContext::default();
context.set_selected_handle_ids(BTreeSet::from([1, 2, 3]));Sourcepub fn set_selected_chat_ids(&mut self, selected_chat_ids: BTreeSet<i32>)
pub fn set_selected_chat_ids(&mut self, selected_chat_ids: BTreeSet<i32>)
Set the chat row IDs included in the query.
§Example:
use std::collections::BTreeSet;
use imessage_database::util::query_context::QueryContext;
let mut context = QueryContext::default();
context.set_selected_chat_ids(BTreeSet::from([1, 2, 3]));Sourcepub fn has_filters(&self) -> bool
pub fn has_filters(&self) -> bool
true when any filter is set.
§Example:
use imessage_database::util::query_context::QueryContext;
let mut context = QueryContext::default();
assert!(!context.has_filters());
context.set_start("2023-01-01");
assert!(context.has_filters());Trait Implementations§
Source§impl Debug for QueryContext
impl Debug for QueryContext
Source§impl Default for QueryContext
impl Default for QueryContext
Source§fn default() -> QueryContext
fn default() -> QueryContext
Returns the “default value” for a type. Read more
impl Eq for QueryContext
Source§impl PartialEq for QueryContext
impl PartialEq for QueryContext
Source§fn eq(&self, other: &QueryContext) -> bool
fn eq(&self, other: &QueryContext) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for QueryContext
Auto Trait Implementations§
impl Freeze for QueryContext
impl RefUnwindSafe for QueryContext
impl Send for QueryContext
impl Sync for QueryContext
impl Unpin for QueryContext
impl UnsafeUnpin for QueryContext
impl UnwindSafe for QueryContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.