Crates.io | imessage-database |
lib.rs | imessage-database |
version | 2.2.1 |
source | src |
created_at | 2022-12-24 21:37:00.317919 |
updated_at | 2024-11-26 19:20:57.38823 |
description | Parsers and tools to interact with iMessage SQLite data |
homepage | |
repository | https://github.com/ReagentX/imessage-exporter |
max_upload_size | |
id | 745069 |
size | 2,266,217 |
This library provides interfaces to interact with iMessage Databases.
This library is available on crates.io.
Documentation is available on docs.rs.
use imessage_database::{
error::table::TableError,
tables::{
messages::Message,
table::{get_connection, Table},
},
util::dirs::default_db_path,
};
fn iter_messages() -> Result<(), TableError> {
/// Create a read-only connection to an iMessage database
let db = get_connection(&default_db_path()).unwrap();
/// Create SQL statement
let mut statement = Message::get(&db)?;
/// Execute statement
let messages = statement
.query_map([], |row| Ok(Message::from_row(row)))
.unwrap();
/// Iterate over each row
for message in messages {
let mut msg = Message::extract(message)?;
/// Deserialize message body
msg.generate_text(&db);
/// Emit debug info for each message
println!("{:?}", msg)
}
Ok(())
}