28 releases (17 stable)

2.2.2 Dec 17, 2024
2.2.1 Nov 26, 2024
2.1.1 Oct 6, 2024
1.9.0 Jun 10, 2024
0.1.4 Dec 30, 2022

#1180 in Database interfaces

Download history 331/week @ 2024-09-20 173/week @ 2024-09-27 334/week @ 2024-10-04 172/week @ 2024-10-11 160/week @ 2024-10-18 127/week @ 2024-10-25 148/week @ 2024-11-01 140/week @ 2024-11-08 179/week @ 2024-11-15 460/week @ 2024-11-22 250/week @ 2024-11-29 401/week @ 2024-12-06 399/week @ 2024-12-13 203/week @ 2024-12-20 173/week @ 2024-12-27 196/week @ 2025-01-03

1,050 downloads per month
Used in imessage-exporter

GPL-3.0-or-later

1MB
13K 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
~585K SLoC