Module table

Module table 

Source
Expand description

This module defines traits for table representations and stores some shared table constants.

§Zero-Allocation Streaming API

This module provides zero-allocation streaming capabilities for all database tables through a callback-based API.

use imessage_database::{
   error::table::TableError,
   tables::{
       table::{get_connection, Table},
       messages::Message,
   },
   util::dirs::default_db_path
};

let db_path = default_db_path();
let db = get_connection(&db_path).unwrap();

Message::stream(&db, |message_result| {
    match message_result {
        Ok(message) => println!("Message: {:#?}", message),
        Err(e) => eprintln!("Error: {:?}", e),
    }
   Ok::<(), TableError>(())
}).unwrap();

Note: you can substitute TableError with your own error type if you want to handle errors differently. See the Table::stream method for more details.

Constants§

ATTACHMENT
Attachment table name
ATTACHMENTS_DIR
Name for attachments directory in exports
ATTRIBUTED_BODY
The attributedBody column contains typedstream-encoded a message’s body text with many other attributes
ATTRIBUTION_INFO
The attribution info contains plist-encoded metadata for sticker attachments
CHAT
Chat table name
CHAT_HANDLE_JOIN
Chat to handle join table name
CHAT_MESSAGE_JOIN
Chat to message join table name
DEFAULT_PATH_IOS
Default location for the Messages database in an iOS backup
DEFAULT_PATH_MACOS
Default location for the Messages database on macOS
FITNESS_RECEIVER
Replacement text sent in Fitness.app messages
HANDLE
Handle table name
ME
Name used for messages sent by the database owner in a first-person context
MESSAGE
Message table name
MESSAGE_ATTACHMENT_JOIN
Message to attachment join table name
MESSAGE_PAYLOAD
The payload data column contains plist-encoded app message data
MESSAGE_SUMMARY_INFO
The message summary info column contains plist-encoded edited message information
ORPHANED
Chat name reserved for messages that do not belong to a chat in the table
PROPERTIES
The properties column contains plist-encoded metadata for a chat
RECENTLY_DELETED
Recently deleted messages table
STICKER_USER_INFO
The sticker user info column contains plist-encoded metadata for sticker attachments
UNKNOWN
Name used for contacts or chats where the name cannot be discovered
YOU
Name used for messages sent by the database owner in a second-person context

Traits§

Cacheable
Defines behavior for table data that can be cached in memory
Deduplicate
Defines behavior for deduplicating data in a table
Diagnostic
Defines behavior for printing diagnostic information for a table
Table
Defines behavior for SQL Table data

Functions§

get_connection
Get a connection to the iMessage SQLite database
get_db_size
Get the size of the database on the disk