Skip to main content

QueryContext

Struct QueryContext 

Source
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

Source

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");
Source

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");
Source

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]));
Source

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]));
Source

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

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for QueryContext

Source§

fn default() -> QueryContext

Returns the “default value” for a type. Read more
Source§

impl Eq for QueryContext

Source§

impl PartialEq for QueryContext

Source§

fn eq(&self, other: &QueryContext) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for QueryContext

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.