Documentation ¶
Overview ¶
Package storage handles all database actions
Index ¶
- func Close()
- func CountRead() int
- func CountTotal() int
- func CountUnread() int
- func DeleteAllMessages() error
- func DeleteOneMessage(id string) error
- func GetAttachmentPart(id, partID string) (*enmime.Part, error)
- func GetMessageRaw(id string) ([]byte, error)
- func InitDB() error
- func IsUnread(id string) bool
- func MarkAllRead() error
- func MarkAllUnread() error
- func MarkRead(id string) error
- func MarkUnread(id string) error
- func SetTags(id string, tags []string) error
- func Store(body []byte) (string, error)
- type Attachment
- type DBMailSummary
- type MailboxStats
- type Message
- type MessageSummary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountRead ¶
func CountRead() int
CountRead returns the number of emails in the database that are read.
func CountUnread ¶
func CountUnread() int
CountUnread returns the number of emails in the database that are unread.
func DeleteAllMessages ¶
func DeleteAllMessages() error
DeleteAllMessages will delete all messages from a mailbox
func DeleteOneMessage ¶
DeleteOneMessage will delete a single message from a mailbox
func GetAttachmentPart ¶
GetAttachmentPart returns an *enmime.Part (attachment or inline) from a message
func GetMessageRaw ¶
GetMessageRaw returns an []byte of the full message
func IsUnread ¶
IsUnread returns the number of emails in the database that are unread. If an ID is supplied, then it is just limited to that message.
Types ¶
type Attachment ¶
type Attachment struct { PartID string FileName string ContentType string ContentID string Size int }
Attachment struct for inline and attachments
func AttachmentSummary ¶
func AttachmentSummary(a *enmime.Part) Attachment
AttachmentSummary returns a summary of the attachment without any binary data
type DBMailSummary ¶
type DBMailSummary struct { Created time.Time From *mail.Address To []*mail.Address Cc []*mail.Address Bcc []*mail.Address Subject string Size int Inline int Attachments int }
DBMailSummary struct for storing mail summary
type MailboxStats ¶
MailboxStats struct for quick mailbox total/read lookups
func StatsGet ¶
func StatsGet() MailboxStats
StatsGet returns the total/unread statistics for a mailbox
type Message ¶
type Message struct { ID string Read bool From *mail.Address To []*mail.Address Cc []*mail.Address Bcc []*mail.Address Subject string Date time.Time Tags []string Text string HTML string Size int Inline []Attachment Attachments []Attachment }
Message struct for loading messages. It does not include physical attachments.
func GetMessage ¶
GetMessage returns a data.Message generated from the mailbox_data collection.
type MessageSummary ¶
type MessageSummary struct { ID string Read bool From *mail.Address To []*mail.Address Cc []*mail.Address Bcc []*mail.Address Subject string Created time.Time Tags []string Size int Attachments int }
MessageSummary struct for frontend messages
func List ¶
func List(start, limit int) ([]MessageSummary, error)
List returns a subset of messages from the mailbox, sorted latest to oldest
func Search ¶
func Search(search string, start, limit int) ([]MessageSummary, error)
Search will search a mailbox for search terms. The search is broken up by segments (exact phrases can be quoted), and interprits specific terms such as: is:read, is:unread, has:attachment, to:<term>, from:<term> & subject:<term> Negative searches also also included by prefixing the search term with a `-` or `!`