pub struct Handle {
pub rowid: i32,
pub id: String,
pub person_centric_id: Option<String>,
}Expand description
Row from the handle table.
Fields§
§rowid: i32Handle row ID.
id: StringPhone number, email address, or service identifier.
person_centric_id: Option<String>Legacy merge ID that the iMessage server used to identify handles for one sender account.
Implementations§
Source§impl Handle
impl Handle
Sourcepub fn get(db: &Connection) -> Result<CachedStatement<'_>, TableError>
pub fn get(db: &Connection) -> Result<CachedStatement<'_>, TableError>
Prepare the SELECT * statement for the handle table.
Sourcepub fn load(db: &Connection) -> Result<Vec<Handle>, TableError>
pub fn load(db: &Connection) -> Result<Vec<Handle>, TableError>
Load every row of the handle table in query order.
Load once and share the rows: borrow them with HandleGroups::from_rows
before consuming them with Handle::ids_by_rowid.
§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::get_connection;
use imessage_database::tables::handle::{Handle, HandleGroups};
let db_path = default_db_path().unwrap();
let conn = get_connection(&db_path).unwrap();
let handles = Handle::load(&conn).unwrap();
let groups = HandleGroups::from_rows(&handles);
let ids = Handle::ids_by_rowid(handles);Sourcepub fn ids_by_rowid(handles: Vec<Handle>) -> HashMap<i32, String>
pub fn ids_by_rowid(handles: Vec<Handle>) -> HashMap<i32, String>
Map handle identifiers by row ID.
In group chats, treat row ID 0 as the local user and map it to ME.
Use HandleGroups to group rows that belong to one person.
§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::get_connection;
use imessage_database::tables::handle::Handle;
let db_path = default_db_path().unwrap();
let conn = get_connection(&db_path).unwrap();
let handles = Handle::ids_by_rowid(Handle::load(&conn).unwrap());Source§impl Handle
impl Handle
Sourcepub fn run_diagnostic(db: &Connection) -> Result<HandleDiagnostic, TableError>
pub fn run_diagnostic(db: &Connection) -> Result<HandleDiagnostic, TableError>
Compute diagnostic data for the handle table.
Group rows with HandleGroups, then report the extra rows absorbed
into groups and the number of groups with multiple rows. Count
person_centric_id values separately when the column exists.
§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::get_connection;
use imessage_database::tables::handle::Handle;
let db_path = default_db_path().unwrap();
let conn = get_connection(&db_path).unwrap();
Handle::run_diagnostic(&conn);Trait Implementations§
Source§impl Table for Handle
impl Table for Handle
Source§fn from_row(row: &Row<'_>) -> Result<Handle>
fn from_row(row: &Row<'_>) -> Result<Handle>
Self. Returns rusqlite::Result
for direct use inside rusqlite::query_map / query_row
callbacks. For high-level iteration, prefer Table::rows or
Table::row.Source§fn rows<'stmt, P: Params>(
stmt: &'stmt mut Statement<'_>,
params: P,
) -> Result<impl Iterator<Item = Result<Self, TableError>> + 'stmt, TableError>where
Self: 'stmt,
fn rows<'stmt, P: Params>(
stmt: &'stmt mut Statement<'_>,
params: P,
) -> Result<impl Iterator<Item = Result<Self, TableError>> + 'stmt, TableError>where
Self: 'stmt,
stmt, deserializing each row through
from_row. Return TableError for both fetch and
deserialization failures. Pass either a rusqlite::Statement or a
rusqlite::CachedStatement (via deref coercion).Source§fn row<P: Params>(
stmt: &mut Statement<'_>,
params: P,
) -> Result<Self, TableError>
fn row<P: Params>( stmt: &mut Statement<'_>, params: P, ) -> Result<Self, TableError>
stmt. Returns
TableError::QueryError if the row is missing or fails to
deserialize. Accepts both rusqlite::Statement and
rusqlite::CachedStatement (the latter via deref coercion).