pub struct ChatToHandle { /* private fields */ }Expand description
Represents a single row in the chat_handle_join table.
Trait Implementations§
Source§impl Cacheable for ChatToHandle
impl Cacheable for ChatToHandle
Source§fn cache(db: &Connection) -> Result<HashMap<Self::K, Self::V>, TableError>
fn cache(db: &Connection) -> Result<HashMap<Self::K, Self::V>, TableError>
Generate a hashmap containing each chatroom’s ID pointing to a HashSet of participant handle IDs
§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::{Cacheable, get_connection};
use imessage_database::tables::chat_handle::ChatToHandle;
let db_path = default_db_path();
let conn = get_connection(&db_path).unwrap();
let chatrooms = ChatToHandle::cache(&conn);Source§impl Deduplicate for ChatToHandle
impl Deduplicate for ChatToHandle
Source§fn dedupe(duplicated_data: &HashMap<i32, Self::T>) -> HashMap<i32, i32>
fn dedupe(duplicated_data: &HashMap<i32, Self::T>) -> HashMap<i32, i32>
Given the initial set of duplicated chats, deduplicate them based on the participants
This returns a new hashmap that maps the real chat ID to a new deduplicated unique chat ID that represents a single chat for all of the same participants, even if they have multiple handles.
Assuming no new chat-handle relationships have been written to the database, deduplicated data is deterministic across runs.
§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::{Cacheable, Deduplicate, get_connection};
use imessage_database::tables::chat_handle::ChatToHandle;
let db_path = default_db_path();
let conn = get_connection(&db_path).unwrap();
let chatrooms = ChatToHandle::cache(&conn).unwrap();
let deduped_chatrooms = ChatToHandle::dedupe(&chatrooms);Source§impl Diagnostic for ChatToHandle
impl Diagnostic for ChatToHandle
Source§fn run_diagnostic(db: &Connection) -> Result<(), TableError>
fn run_diagnostic(db: &Connection) -> Result<(), TableError>
Emit diagnostic data for the Chat to Handle join table
Get the number of chats referenced in the messages table that do not exist in this join table:
§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::{Diagnostic, get_connection};
use imessage_database::tables::chat_handle::ChatToHandle;
let db_path = default_db_path();
let conn = get_connection(&db_path).unwrap();
ChatToHandle::run_diagnostic(&conn);Source§impl Table for ChatToHandle
impl Table for ChatToHandle
Source§fn from_row(row: &Row<'_>) -> Result<ChatToHandle>
fn from_row(row: &Row<'_>) -> Result<ChatToHandle>
Deserialize a single row into Self, returning a
rusqlite::ResultSource§fn get(db: &Connection) -> Result<CachedStatement<'_>, TableError>
fn get(db: &Connection) -> Result<CachedStatement<'_>, TableError>
Prepare SELECT * statement
Source§fn extract(
chat_to_handle: Result<Result<Self, Error>, Error>,
) -> Result<Self, TableError>
fn extract( chat_to_handle: Result<Result<Self, Error>, Error>, ) -> Result<Self, TableError>
Map a
rusqlite::Result<Self> into our TableErrorSource§fn stream<F, E>(db: &Connection, callback: F) -> Result<(), TableError>
fn stream<F, E>(db: &Connection, callback: F) -> Result<(), TableError>
Process all rows from the table using a callback.
This is the most memory-efficient approach for large tables. Read more
Auto Trait Implementations§
impl Freeze for ChatToHandle
impl RefUnwindSafe for ChatToHandle
impl Send for ChatToHandle
impl Sync for ChatToHandle
impl Unpin for ChatToHandle
impl UnwindSafe for ChatToHandle
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