chatdb

package
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package chatdb provides an interface ChatDB for interacting with the Mac OS Messages database typically located at $HOME/Library/Messages/chat.db. See [this Medium post](https://towardsdatascience.com/heres-how-you-can-access-your-entire-imessage-history-on-your-mac-f8878276c6e9) for a decent primer on navigating the database. Specifically, this package is tailored to supporting the exporting of all messages in the database to readable, searchable text files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	ID          int
	GUID        string
	DisplayName string
}

Chat represents a row from the chat table.

type ChatDB

type ChatDB interface {
	// GetHandleMap returns a mapping from handle ID to phone number or email
	// address. If a contact map is supplied, it will attempt to resolve these
	// handles to formatted names.
	GetHandleMap(contactMap map[string]*vcard.Card) (map[int]string, error)
	// GetChats returns a slice of Chat, effectively a table scan of the chat
	// table.
	GetChats(contactMap map[string]*vcard.Card) ([]Chat, error)
	// GetMessageIDs returns a slice of message IDs corresponding to a given
	// chat ID, in the order that the messages are timestamped.
	GetMessageIDs(chatID int) ([]int, error)
	// GetMessage returns a message retrieved from the database formatted for
	// writing to a chat file.
	GetMessage(messageID int, handleMap map[int]string, macOSVersion *semver.Version) (string, error)
}

ChatDB extracts data from a Mac OS Messages database on disk.

func NewChatDB

func NewChatDB(db *sql.DB, selfHandle string) ChatDB

NewChatDB returns a ChatDB interface using the given DB.

Directories

Path Synopsis
Package mock_chatdb is a generated GoMock package.
Package mock_chatdb is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL