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

Represents filter configurations for a SQL query.

Fields§

§start: Option<i64>

The start date filter. Only messages sent on or after this date will be included.

§end: Option<i64>

The end date filter. Only messages sent before this date will be included.

§selected_handle_ids: Option<BTreeSet<i32>>

Selected handle IDs

§selected_chat_ids: Option<BTreeSet<i32>>

Selected chat IDs

Implementations§

Source§

impl QueryContext

Source

pub fn set_start(&mut self, start: &str) -> Result<(), QueryContextError>

Populate a QueryContext with a start date

§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>

Populate a QueryContext with an end date

§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>)

Populate a QueryContext with a list of handle IDs to select

§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>)

Populate a QueryContext with a list of chat IDs to select

§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

Determine if the current QueryContext has any filters present

§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 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 · 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 Eq for QueryContext

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<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.