Documentation ¶
Index ¶
- func CheckVersion() error
- type Database
- func (db *Database) BeginAtomic() error
- func (db *Database) Close() error
- func (db *Database) Compact(backupPath string) error
- func (db *Database) Create() error
- func (db *Database) Directory(relativePath string) (Directory, error)
- func (db *Database) EndAtomic() error
- func (db *Database) FindMessageByFilename(filename string) (Message, error)
- func (db *Database) FindMessageByID(id string) (Message, error)
- func (db *Database) IndexFile(path string) (Message, error)
- func (db *Database) LastStatus() string
- func (db *Database) NeedsUpgrade() bool
- func (db *Database) Open(mode Mode) error
- func (db *Database) Query(query string) (Query, error)
- func (db *Database) RemoveFile(path string) error
- func (db *Database) Reopen(mode Mode) error
- func (db *Database) ResolvedPath() string
- func (db *Database) Revision() (string, uint64)
- func (db *Database) Tags() []string
- type Directory
- type ExcludeMode
- type Flag
- type Message
- func (m *Message) AddProperty(key string, value string) error
- func (m *Message) AddTag(tag string) error
- func (m *Message) Close()
- func (m *Message) CountProperties(key string) (int, error)
- func (m *Message) Date() time.Time
- func (m *Message) Filename() string
- func (m *Message) Filenames() []string
- func (m *Message) Flag(flag Flag) (bool, error)
- func (m *Message) Freeze() error
- func (m *Message) HasMaildirFlag(flag rune) (bool, error)
- func (m *Message) Header(field string) string
- func (m *Message) ID() string
- func (m *Message) Properties(key string, exact bool) *Properties
- func (m *Message) Property(key string) (string, error)
- func (m *Message) RemoveAllProperties(key string) error
- func (m *Message) RemoveAllPropertiesWithPrefix(prefix string) error
- func (m *Message) RemoveAllTags() error
- func (m *Message) RemoveProperty(key string, value string) error
- func (m *Message) RemoveTag(tag string) error
- func (m *Message) Replies() Messages
- func (m *Message) SyncMaildirFlagsToTags() error
- func (m *Message) SyncTagsToMaildirFlags() error
- func (m *Message) Tags() []string
- func (m *Message) Thaw() error
- func (m *Message) ThreadID() string
- func (m *Message) TotalFiles() int
- type Messages
- type Mode
- type Properties
- type Query
- func (q *Query) Close()
- func (q *Query) CountMessages() (int, error)
- func (q *Query) CountThreads() (int, error)
- func (q *Query) Database() Database
- func (q *Query) Exclude(val ExcludeMode)
- func (q *Query) ExcludeTag(tag string) error
- func (q *Query) Messages() (Messages, error)
- func (q *Query) Sort(sort SortMode)
- func (q *Query) SortMode() SortMode
- func (q *Query) String() string
- func (q *Query) Threads() (Threads, error)
- type SortMode
- type Status
- type Thread
- func (t *Thread) Authors() string
- func (t *Thread) Close()
- func (t *Thread) ID() string
- func (t *Thread) Matches() int
- func (t *Thread) Messages() Messages
- func (t *Thread) NewestDate() time.Time
- func (t *Thread) OldestDate() time.Time
- func (t *Thread) Subject() string
- func (t *Thread) Tags() []string
- func (t *Thread) TopLevelMessages() Messages
- func (t *Thread) TotalFiles() int
- func (t *Thread) TotalMessages() int
- type Threads
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckVersion ¶
func CheckVersion() error
CheckVersion verifies that package libnotmuch is compiled against a notmuch.h of the proper version. Currently v5.6.0 is the minimum required version
Types ¶
type Database ¶
type Database struct { // The path to the notmuch database. If Path is the empty string, the // location will be found in the following order: // // 1. The value of the environment variable NOTMUCH_DATABASE // 2. From the config file specified by Config // 3. From the Profile specified by profile, given by // $XDG_DATA_HOME/notmuch/$PROFILE Path string // The path to the notmuch configuration file to use. Config string // If FindConfig is true, libnotmuch will attempt to locate a suitable // configuration file in the following order: // // 1. The value of the environment variable NOTMUCH_CONFIG // 2. $XDG_CONFIG_HOME/notmuch/ // 3. $HOME/.notmuch-config // // If not configuration file is found, a STATUS_NO_CONFIG error will be // returned FindConfig bool // The profile to use. If Profile is non-empty, the value will be // appended to the paths determined for Config and Path. If Profile is // the empty string, the profile will be determined in the following // order: // // 1. The value of the environment variable NOTMUCH_PROFILE // 2. "default" if Config and/or Path are a directory, "" if they are a // filepath Profile string // contains filtered or unexported fields }
func (*Database) BeginAtomic ¶
Indicate the beginning of an atomic operation
func (*Database) Close ¶
Close commits changes and closes the database, freeing any resources associated with it
func (*Database) FindMessageByFilename ¶
FindMessageByFilename finds a message by filename
func (*Database) FindMessageByID ¶
FindMessageByID finds a message by the Message-ID header field value
func (*Database) IndexFile ¶
IndexFile indexes a file with path relative to the database path, or an absolute path which share a common ancestor as the database path
func (*Database) LastStatus ¶
LastStatus returns the last status string for the database
func (*Database) NeedsUpgrade ¶
NeedsUpgrade reports if the database must be upgraded before a write operation can be safely performed
func (*Database) Open ¶
Open opens the database with the given mode. Caller must call Close when done to commit changes and free resources
func (*Database) RemoveFile ¶
Remove a file from the database. If this is the last file associated with a message, the message will be removed from the database.
func (*Database) ResolvedPath ¶
Return the resolved path to the notmuch database
type Directory ¶
type Directory struct {
// contains filtered or unexported fields
}
func (*Directory) Delete ¶
Delete deletes a directory document from the database and destroys the underlying object. Any child directories and files must have been deleted firs the caller
func (*Directory) Directories ¶
func (*Directory) ModifiedTime ¶
type ExcludeMode ¶
type ExcludeMode int
const ( EXCLUDE_FLAG ExcludeMode = C.NOTMUCH_EXCLUDE_FLAG EXCLUDE_TRUE ExcludeMode = C.NOTMUCH_EXCLUDE_TRUE EXCLUDE_FALSE ExcludeMode = C.NOTMUCH_EXCLUDE_FALSE EXCLUDE_ALL ExcludeMode = C.NOTMUCH_EXCLUDE_ALL )
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func (*Message) Filename ¶
Filename returns a single filename associated with the message. If the message has multiple filenames, the return value will be arbitrarily chosen
func (*Message) Properties ¶
func (m *Message) Properties(key string, exact bool) *Properties
func (*Message) RemoveAllProperties ¶
func (*Message) RemoveAllPropertiesWithPrefix ¶
func (*Message) RemoveAllTags ¶
func (*Message) SyncMaildirFlagsToTags ¶
SyncMaildirFlagsToTags syncs the current maildir flags to the notmuch tags
func (*Message) SyncTagsToMaildirFlags ¶
SyncTagsToMaildirFlags adds/removes the appropriate tags to the maildir filename
func (*Message) TotalFiles ¶
type Messages ¶
type Messages struct {
// contains filtered or unexported fields
}
func (*Messages) Close ¶
func (m *Messages) Close()
Close frees memory associated with a Messages iterator. This method is not strictly necessary to call, as the resources will be freed when the Query associated with the Messages object is freed.
type Mode ¶
type Mode int
const ( MODE_READ_ONLY Mode = C.NOTMUCH_DATABASE_MODE_READ_ONLY MODE_READ_WRITE Mode = C.NOTMUCH_DATABASE_MODE_READ_WRITE )
type Properties ¶
type Properties struct {
// contains filtered or unexported fields
}
func (*Properties) Key ¶
func (p *Properties) Key() string
Returns the key of the current iterator location
func (*Properties) Next ¶
func (p *Properties) Next() bool
Next advances the Properties iterator to the next property. Next returns false if no more properties are available
func (*Properties) Value ¶
func (p *Properties) Value() string
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func (*Query) Close ¶
func (q *Query) Close()
Close frees resources associated with a query. Closing a query release all resources associated with any underlying search (Threads, Messages, etc)
func (*Query) CountMessages ¶
CountMessages returns the number of messages matching the query
func (*Query) CountThreads ¶
CountThreads returns the number of threads matching the query
func (*Query) Database ¶
Returns the Database associated with the query. The Path, Config, and Profile values will not be set on the returned valued
func (*Query) ExcludeTag ¶
ExcludeTag adds a tag to exclude from the results
type SortMode ¶
type SortMode int
const ( SORT_OLDEST_FIRST SortMode = C.NOTMUCH_SORT_OLDEST_FIRST SORT_NEWEST_FIRST SortMode = C.NOTMUCH_SORT_NEWEST_FIRST SORT_MESSAGE_ID SortMode = C.NOTMUCH_SORT_MESSAGE_ID SORT_UNSORTED SortMode = C.NOTMUCH_SORT_UNSORTED )
type Status ¶
type Status int
Status codes used for the return values of most functions
const ( STATUS_SUCCESS Status = C.NOTMUCH_STATUS_SUCCESS STATUS_OUT_OF_MEMORY Status = C.NOTMUCH_STATUS_OUT_OF_MEMORY STATUS_READ_ONLY_DATABASE Status = C.NOTMUCH_STATUS_READ_ONLY_DATABASE STATUS_XAPIAN_EXCEPTION Status = C.NOTMUCH_STATUS_XAPIAN_EXCEPTION STATUS_FILE_ERROR Status = C.NOTMUCH_STATUS_FILE_ERROR STATUS_FILE_NOT_EMAIL Status = C.NOTMUCH_STATUS_FILE_NOT_EMAIL STATUS_DUPLICATE_MESSAGE_ID Status = C.NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID STATUS_NULL_POINTER Status = C.NOTMUCH_STATUS_NULL_POINTER STATUS_TAG_TOO_LONG Status = C.NOTMUCH_STATUS_TAG_TOO_LONG STATUS_UNBALANCED_FREEZE_THAW Status = C.NOTMUCH_STATUS_UNBALANCED_FREEZE_THAW STATUS_UNBALANCED_ATOMIC Status = C.NOTMUCH_STATUS_UNBALANCED_ATOMIC STATUS_UNSUPPORTED_OPERATION Status = C.NOTMUCH_STATUS_UNSUPPORTED_OPERATION STATUS_UPGRADE_REQUIRED Status = C.NOTMUCH_STATUS_UPGRADE_REQUIRED STATUS_PATH_ERROR Status = C.NOTMUCH_STATUS_PATH_ERROR STATUS_IGNORED Status = C.NOTMUCH_STATUS_IGNORED STATUS_ILLEGAL_ARGUMENT Status = C.NOTMUCH_STATUS_ILLEGAL_ARGUMENT STATUS_MALFORMED_CRYPTO_PROTOCOL Status = C.NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL STATUS_FAILED_CRYPTO_CONTEXT_CREATION Status = C.NOTMUCH_STATUS_FAILED_CRYPTO_CONTEXT_CREATION STATUS_UNKNOWN_CRYPTO_PROTOCOL Status = C.NOTMUCH_STATUS_UNKNOWN_CRYPTO_PROTOCOL STATUS_NO_CONFIG Status = C.NOTMUCH_STATUS_NO_CONFIG STATUS_NO_DATABASE Status = C.NOTMUCH_STATUS_NO_DATABASE STATUS_DATABASE_EXISTS Status = C.NOTMUCH_STATUS_DATABASE_EXISTS STATUS_BAD_QUERY_SYNTAX Status = C.NOTMUCH_STATUS_BAD_QUERY_SYNTAX STATUS_NO_MAIL_ROOT Status = C.NOTMUCH_STATUS_NO_MAIL_ROOT STATUS_CLOSED_DATABASE Status = C.NOTMUCH_STATUS_CLOSED_DATABASE )
type Thread ¶
type Thread struct {
// contains filtered or unexported fields
}
func (*Thread) Matches ¶
Matches returns the number of messages in the thread that matched the query
func (*Thread) Messages ¶
Messages returns an iterator over the messages in the thread. Messages are sorted oldest-first
func (*Thread) NewestDate ¶
Returns the sent-date of the newest message in the thread
func (*Thread) OldestDate ¶
Returns the sent-date of the oldest message in the thread
func (*Thread) TopLevelMessages ¶
TopLevelMessages returns an iterator over the top level messages in the thread. Messages are sorted oldest-first
func (*Thread) TotalFiles ¶
TotalMessages returns the total number of files in the thread
func (*Thread) TotalMessages ¶
TotalMessages returns the total number of messages in the thread
type Threads ¶
type Threads struct {
// contains filtered or unexported fields
}
Threads is an iterator over a set of threads.
func (*Threads) Close ¶
func (t *Threads) Close()
Close frees memory associated with a Threads iterator. This method is not strictly necessary to call, as the resources will be freed when the Query associated with the Threads object is freed.