25 releases (14 stable)

2.1.1 Oct 6, 2024
2.0.1 Aug 3, 2024
1.9.0 Jun 10, 2024
1.8.0 Dec 4, 2023
0.1.4 Dec 30, 2022

#1260 in Database interfaces

Download history 293/week @ 2024-07-28 250/week @ 2024-08-04 116/week @ 2024-08-11 122/week @ 2024-08-18 129/week @ 2024-08-25 126/week @ 2024-09-01 132/week @ 2024-09-08 360/week @ 2024-09-15 234/week @ 2024-09-22 176/week @ 2024-09-29 339/week @ 2024-10-06 168/week @ 2024-10-13 144/week @ 2024-10-20 147/week @ 2024-10-27 146/week @ 2024-11-03 142/week @ 2024-11-10

601 downloads per month
Used in imessage-exporter

GPL-3.0-or-later

1MB
12K SLoC

imessage-database

This library provides interfaces to interact with iMessage Databases.

Installation

This library is available on crates.io.

Documentation

Documentation is available on docs.rs.

Example

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(())
}

Dependencies

~31MB
~577K SLoC