Skip to main content

Store

Struct Store 

Source
pub struct Store { /* private fields */ }

Implementations§

Source§

impl Store

Source

pub async fn insert_account(&self, account: &Account) -> Result<(), Error>

Source

pub async fn get_account( &self, id: &AccountId, ) -> Result<Option<Account>, Error>

Source

pub async fn list_accounts(&self) -> Result<Vec<Account>, Error>

Source§

impl Store

Source

pub async fn get_body( &self, message_id: &MessageId, ) -> Result<Option<MessageBody>, Error>

Source

pub async fn insert_body(&self, body: &MessageBody) -> Result<(), Error>

Source§

impl Store

Source§

impl Store

Source

pub async fn insert_draft(&self, draft: &Draft) -> Result<(), Error>

Source

pub async fn get_draft(&self, id: &DraftId) -> Result<Option<Draft>, Error>

Source

pub async fn list_drafts( &self, account_id: &AccountId, ) -> Result<Vec<Draft>, Error>

Source

pub async fn delete_draft(&self, id: &DraftId) -> Result<(), Error>

Source§

impl Store

Source

pub async fn insert_event_refs( &self, level: &str, category: &str, summary: &str, refs: EventLogRefs<'_>, details: Option<&str>, ) -> Result<(), Error>

Source

pub async fn insert_event( &self, level: &str, category: &str, summary: &str, account_id: Option<&AccountId>, details: Option<&str>, ) -> Result<(), Error>

Source

pub async fn list_events( &self, limit: u32, level: Option<&str>, category: Option<&str>, ) -> Result<Vec<EventLogEntry>, Error>

Source

pub async fn prune_events_before( &self, cutoff_timestamp: i64, ) -> Result<u64, Error>

Source

pub async fn latest_event_timestamp( &self, category: &str, summary_prefix: Option<&str>, ) -> Result<Option<DateTime<Utc>>, Error>

Source§

impl Store

Source

pub async fn upsert_label(&self, label: &Label) -> Result<(), Error>

Source

pub async fn list_labels_by_account( &self, account_id: &AccountId, ) -> Result<Vec<Label>, Error>

Source

pub async fn update_label_counts( &self, label_id: &LabelId, unread_count: u32, total_count: u32, ) -> Result<(), Error>

Source

pub async fn delete_label(&self, label_id: &LabelId) -> Result<(), Error>

Source

pub async fn replace_label( &self, old_label_id: &LabelId, new_label: &Label, ) -> Result<(), Error>

Source

pub async fn recalculate_label_counts( &self, account_id: &AccountId, ) -> Result<(), Error>

Source

pub async fn find_labels_by_provider_ids( &self, account_id: &AccountId, provider_ids: &[String], ) -> Result<Vec<LabelId>, Error>

Look up LabelIds from a list of provider_ids (e.g. [“INBOX”, “SENT”]). Returns only the IDs for labels that exist in the store.

Source

pub async fn find_label_by_provider_id( &self, account_id: &AccountId, provider_id: &str, ) -> Result<Option<Label>, Error>

Source§

impl Store

Source

pub async fn upsert_envelope(&self, envelope: &Envelope) -> Result<(), Error>

Source

pub async fn get_envelope( &self, id: &MessageId, ) -> Result<Option<Envelope>, Error>

Source

pub async fn list_envelopes_by_label( &self, label_id: &LabelId, limit: u32, offset: u32, ) -> Result<Vec<Envelope>, Error>

Source

pub async fn list_envelopes_by_account( &self, account_id: &AccountId, limit: u32, offset: u32, ) -> Result<Vec<Envelope>, Error>

Source

pub async fn list_envelopes_by_ids( &self, message_ids: &[MessageId], ) -> Result<Vec<Envelope>, Error>

Source

pub async fn delete_messages_by_provider_ids( &self, account_id: &AccountId, provider_ids: &[String], ) -> Result<u64, Error>

Source

pub async fn set_message_labels( &self, message_id: &MessageId, label_ids: &[LabelId], ) -> Result<(), Error>

Source

pub async fn update_message_thread_id( &self, message_id: &MessageId, thread_id: &ThreadId, ) -> Result<(), Error>

Source

pub async fn get_message_id_by_provider_id( &self, account_id: &AccountId, provider_id: &str, ) -> Result<Option<MessageId>, Error>

Source

pub async fn count_messages_by_account( &self, account_id: &AccountId, ) -> Result<u32, Error>

Source

pub async fn list_all_envelopes_paginated( &self, limit: u32, offset: u32, ) -> Result<Vec<Envelope>, Error>

List all envelopes across all accounts, paginated. Used for reindexing.

Source

pub async fn count_all_messages(&self) -> Result<u32, Error>

Count all messages across all accounts. Used for reindexing.

Source

pub async fn update_flags( &self, message_id: &MessageId, flags: MessageFlags, ) -> Result<(), Error>

Source

pub async fn set_read( &self, message_id: &MessageId, read: bool, ) -> Result<(), Error>

Set the read flag on a message.

Source

pub async fn set_starred( &self, message_id: &MessageId, starred: bool, ) -> Result<(), Error>

Set the starred flag on a message.

Source

pub async fn get_provider_id( &self, message_id: &MessageId, ) -> Result<Option<String>, Error>

Get the provider_id for a message.

Source

pub async fn get_message_label_ids( &self, message_id: &MessageId, ) -> Result<Vec<LabelId>, Error>

Get the label IDs for a message.

Source

pub async fn add_message_label( &self, message_id: &MessageId, label_id: &LabelId, ) -> Result<(), Error>

Add a label to a message.

Source

pub async fn remove_message_label( &self, message_id: &MessageId, label_id: &LabelId, ) -> Result<(), Error>

Remove a label from a message.

Source

pub async fn count_message_labels(&self) -> Result<u32, Error>

Count total rows in the message_labels junction table.

Source

pub async fn move_to_trash(&self, message_id: &MessageId) -> Result<(), Error>

Mark a message as trashed (update flags).

Source

pub async fn list_contacts( &self, limit: u32, ) -> Result<Vec<(String, String)>, Error>

Get distinct contacts (name + email) from message senders, ordered by frequency.

Source

pub async fn list_subscriptions( &self, limit: u32, ) -> Result<Vec<SubscriptionSummary>, Error>

Source§

impl Store

Source

pub async fn new(db_path: &Path) -> Result<Self, Error>

Source

pub async fn in_memory() -> Result<Self, Error>

Source

pub fn writer(&self) -> &SqlitePool

Source

pub fn reader(&self) -> &SqlitePool

Source§

impl Store

Source

pub async fn upsert_rule(&self, rule: RuleRecordInput<'_>) -> Result<(), Error>

Source

pub async fn list_rules(&self) -> Result<Vec<SqliteRow>, Error>

Source

pub async fn get_rule_by_id_or_name( &self, key: &str, ) -> Result<Option<SqliteRow>, Error>

Source

pub async fn delete_rule(&self, id: &str) -> Result<(), Error>

Source

pub async fn insert_rule_log(&self, log: RuleLogInput<'_>) -> Result<(), Error>

Source

pub async fn list_rule_logs( &self, rule_id: Option<&str>, limit: u32, ) -> Result<Vec<SqliteRow>, Error>

Source§

impl Store

Source

pub async fn list_saved_searches(&self) -> Result<Vec<SavedSearch>, Error>

Source

pub async fn get_saved_search_by_name( &self, name: &str, ) -> Result<Option<SavedSearch>, Error>

Source

pub async fn delete_saved_search_by_name( &self, name: &str, ) -> Result<bool, Error>

Source§

impl Store

Source§

impl Store

Source

pub async fn insert_snooze(&self, snoozed: &Snoozed) -> Result<(), Error>

Source

pub async fn get_due_snoozes( &self, now: DateTime<Utc>, ) -> Result<Vec<Snoozed>, Error>

Source

pub async fn list_snoozed(&self) -> Result<Vec<Snoozed>, Error>

Source

pub async fn get_snooze( &self, message_id: &MessageId, ) -> Result<Option<Snoozed>, Error>

Source

pub async fn remove_snooze(&self, message_id: &MessageId) -> Result<(), Error>

Source§

impl Store

Source

pub async fn get_sync_cursor( &self, account_id: &AccountId, ) -> Result<Option<SyncCursor>, Error>

Source

pub async fn set_sync_cursor( &self, account_id: &AccountId, cursor: &SyncCursor, ) -> Result<(), Error>

Source§

impl Store

Source

pub async fn insert_sync_log( &self, account_id: &AccountId, status: &SyncStatus, ) -> Result<i64, Error>

Source

pub async fn complete_sync_log( &self, log_id: i64, status: &SyncStatus, messages_synced: u32, error_message: Option<&str>, ) -> Result<(), Error>

Source

pub async fn get_last_sync( &self, account_id: &AccountId, ) -> Result<Option<SyncLogEntry>, Error>

Source§

impl Store

Source§

impl Store

Source

pub async fn get_thread( &self, thread_id: &ThreadId, ) -> Result<Option<Thread>, Error>

Source

pub async fn get_thread_envelopes( &self, thread_id: &ThreadId, ) -> Result<Vec<Envelope>, Error>

Auto Trait Implementations§

§

impl Freeze for Store

§

impl !RefUnwindSafe for Store

§

impl Send for Store

§

impl Sync for Store

§

impl Unpin for Store

§

impl UnsafeUnpin for Store

§

impl !UnwindSafe for Store

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more