Documentation ¶
Index ¶
- Constants
- func AddMessageFlag(ctx context.Context, tx *ent.Tx, messageIDs []imap.InternalMessageID, ...) error
- func BumpMailboxUIDNext(ctx context.Context, tx *ent.Tx, mbox *ent.Mailbox, withCount ...int) error
- func ClearRecentFlag(ctx context.Context, tx *ent.Tx, mboxID imap.InternalMailboxID, ...) error
- func ClearRecentFlags(ctx context.Context, tx *ent.Tx, mboxID imap.InternalMailboxID) error
- func CreateAndAddMessageToMailbox(ctx context.Context, tx *ent.Tx, mboxID imap.InternalMailboxID, ...) (imap.UID, imap.FlagSet, error)
- func CreateMailbox(ctx context.Context, tx *ent.Tx, mboxID imap.MailboxID, name string, ...) (*ent.Mailbox, error)
- func CreateMailboxIfNotExists(ctx context.Context, tx *ent.Tx, mbox imap.Mailbox, delimiter string, ...) error
- func CreateMessages(ctx context.Context, tx *ent.Tx, reqs ...*CreateMessageReq) ([]*ent.Message, error)
- func DeleteDB(dir, userID string) error
- func DeleteMailboxWithRemoteID(ctx context.Context, tx *ent.Tx, mboxID imap.MailboxID, ...) (imap.UID, error)
- func DeleteMessages(ctx context.Context, tx *ent.Tx, messageIDs ...imap.InternalMessageID) error
- func FilterMailboxContains(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID, ...) ([]imap.InternalMessageID, error)
- func GetAllMailboxes(ctx context.Context, client *ent.Client) ([]*ent.Mailbox, error)
- func GetAllMessagesIDsAsMap(ctx context.Context, client *ent.Client) (map[imap.InternalMessageID]struct{}, error)
- func GetHighestMessageID(ctx context.Context, client *ent.Client) (imap.InternalMessageID, error)
- func GetImportedMessageData(ctx context.Context, client *ent.Client, messageID imap.InternalMessageID) (*ent.Message, error)
- func GetMailboxByID(ctx context.Context, client *ent.Client, id imap.InternalMailboxID) (*ent.Mailbox, error)
- func GetMailboxByName(ctx context.Context, client *ent.Client, name string) (*ent.Mailbox, error)
- func GetMailboxByRemoteID(ctx context.Context, client *ent.Client, id imap.MailboxID) (*ent.Mailbox, error)
- func GetMailboxIDFromRemoteID(ctx context.Context, client *ent.Client, mboxID imap.MailboxID) (imap.InternalMailboxID, error)
- func GetMailboxIDWithRemoteID(ctx context.Context, client *ent.Client, mboxID imap.MailboxID) (imap.InternalMailboxID, error)
- func GetMailboxMessageCount(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID) (int, error)
- func GetMailboxMessageIDPairs(ctx context.Context, client *ent.Client, mailboxID imap.InternalMailboxID) ([]ids.MessageIDPair, error)
- func GetMailboxName(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID) (string, error)
- func GetMailboxNameWithRemoteID(ctx context.Context, client *ent.Client, mboxID imap.MailboxID) (string, error)
- func GetMailboxRecentCount(ctx context.Context, client *ent.Client, mbox *ent.Mailbox) (int, error)
- func GetMessage(ctx context.Context, client *ent.Client, messageID imap.InternalMessageID) (*ent.Message, error)
- func GetMessageDateAndSize(ctx context.Context, client *ent.Client, messageID imap.InternalMessageID) (*ent.Message, error)
- func GetMessageDeleted(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID, ...) (map[imap.InternalMessageID]bool, error)
- func GetMessageFromRemoteIDWithDeletedFlag(ctx context.Context, client *ent.Client, id imap.MessageID) (*ent.Message, error)
- func GetMessageIDFromRemoteID(ctx context.Context, client *ent.Client, id imap.MessageID) (imap.InternalMessageID, error)
- func GetMessageIDsMarkedDeleted(ctx context.Context, client *ent.Client) ([]imap.InternalMessageID, error)
- func GetMessageMailboxIDs(ctx context.Context, client *ent.Client, messageID imap.InternalMessageID) ([]imap.InternalMailboxID, error)
- func GetMessageRemoteIDFromID(ctx context.Context, client *ent.Client, id imap.InternalMessageID) (imap.MessageID, error)
- func GetMessageWithIDWithDeletedFlag(ctx context.Context, client *ent.Client, id imap.InternalMessageID) (*ent.Message, error)
- func GetOrCreateMailbox(ctx context.Context, tx *ent.Tx, mbox imap.Mailbox, delimiter string, ...) (*ent.Mailbox, error)
- func HasMessageWithID(ctx context.Context, client *ent.Client, id imap.InternalMessageID) (bool, error)
- func HasMessageWithRemoteID(ctx context.Context, client *ent.Client, id imap.MessageID) (bool, error)
- func MailboxExistsWithID(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID) (bool, error)
- func MailboxExistsWithName(ctx context.Context, client *ent.Client, name string) (bool, error)
- func MailboxExistsWithRemoteID(ctx context.Context, client *ent.Client, mboxID imap.MailboxID) (bool, error)
- func MarkMessageAsDeleted(ctx context.Context, tx *ent.Tx, messageID imap.InternalMessageID) error
- func MarkMessageAsDeletedWithRemoteID(ctx context.Context, tx *ent.Tx, messageID imap.MessageID) error
- func MessageExistsWithRemoteID(ctx context.Context, client *ent.Client, messageID imap.MessageID) (bool, error)
- func NewFlagSet(msgUID *ent.UID, flags []*ent.MessageFlag) imap.FlagSet
- func ReadResult[T any](ctx context.Context, db *DB, fn func(context.Context, *ent.Client) (T, error)) (T, error)
- func RemoveMessageFlag(ctx context.Context, tx *ent.Tx, messageIDs []imap.InternalMessageID, ...) error
- func RemoveMessagesFromMailbox(ctx context.Context, tx *ent.Tx, messageIDs []imap.InternalMessageID, ...) error
- func RenameMailboxWithRemoteID(ctx context.Context, tx *ent.Tx, mboxID imap.MailboxID, name string) error
- func SetDeletedFlag(ctx context.Context, tx *ent.Tx, mboxID imap.InternalMailboxID, ...) error
- func SetMessageFlags(ctx context.Context, tx *ent.Tx, messageIDs []imap.InternalMessageID, ...) error
- func TranslateRemoteMailboxIDs(ctx context.Context, client *ent.Client, mboxIDs []imap.MailboxID) ([]imap.InternalMailboxID, error)
- func UpdateRemoteMailboxID(ctx context.Context, tx *ent.Tx, internalID imap.InternalMailboxID, ...) error
- func UpdateRemoteMessageID(ctx context.Context, tx *ent.Tx, internalID imap.InternalMessageID, ...) error
- func WriteResult[T any](ctx context.Context, db *DB, fn func(context.Context, *ent.Tx) (T, error)) (T, error)
- type CreateAndAddMessagesResult
- type CreateMessageReq
- type DB
- type MessageFlagSet
- type SnapshotMessageResult
- type UIDWithFlags
- func AddMessagesToMailbox(ctx context.Context, tx *ent.Tx, messageIDs []imap.InternalMessageID, ...) ([]UIDWithFlags, error)
- func BumpMailboxUIDsForMessage(ctx context.Context, tx *ent.Tx, messageIDs []imap.InternalMessageID, ...) ([]UIDWithFlags, error)
- func GetMessageUIDsWithFlagsAfterAddOrUIDBump(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID, ...) ([]UIDWithFlags, error)
Constants ¶
View Source
const ChunkLimit = 1000
Variables ¶
This section is empty.
Functions ¶
func AddMessageFlag ¶
func BumpMailboxUIDNext ¶
func ClearRecentFlag ¶
func ClearRecentFlag(ctx context.Context, tx *ent.Tx, mboxID imap.InternalMailboxID, messageID imap.InternalMessageID) error
func ClearRecentFlags ¶
func CreateMailbox ¶
func CreateMessages ¶
func DeleteMailboxWithRemoteID ¶
func DeleteMailboxWithRemoteID( ctx context.Context, tx *ent.Tx, mboxID imap.MailboxID, curUIDValidity imap.UID, ) (imap.UID, error)
DeleteMailboxWithRemoteID deletes the mailbox with the given remote ID. It returns the (potentially new) global UID validity.
func DeleteMessages ¶
func FilterMailboxContains ¶
func FilterMailboxContains(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID, messageIDs []ids.MessageIDPair) ([]imap.InternalMessageID, error)
func GetAllMailboxes ¶
func GetAllMessagesIDsAsMap ¶
func GetHighestMessageID ¶
func GetImportedMessageData ¶ added in v0.14.0
func GetMailboxByID ¶
func GetMailboxByName ¶
func GetMailboxByRemoteID ¶
func GetMailboxIDFromRemoteID ¶ added in v0.14.0
func GetMailboxMessageCount ¶ added in v0.14.0
func GetMailboxMessageIDPairs ¶
func GetMailboxMessageIDPairs(ctx context.Context, client *ent.Client, mailboxID imap.InternalMailboxID) ([]ids.MessageIDPair, error)
func GetMailboxName ¶
func GetMailboxRecentCount ¶
func GetMessage ¶
func GetMessageDateAndSize ¶
func GetMessageDeleted ¶
func GetMessageDeleted(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID, messageIDs []imap.InternalMessageID) (map[imap.InternalMessageID]bool, error)
func GetMessageFromRemoteIDWithDeletedFlag ¶ added in v0.14.0
func GetMessageMailboxIDs ¶
func GetMessageMailboxIDs(ctx context.Context, client *ent.Client, messageID imap.InternalMessageID) ([]imap.InternalMailboxID, error)
func GetMessageRemoteIDFromID ¶ added in v0.14.0
func GetMessageWithIDWithDeletedFlag ¶ added in v0.14.0
func GetOrCreateMailbox ¶ added in v0.14.0
func HasMessageWithID ¶
func HasMessageWithRemoteID ¶
func MailboxExistsWithID ¶
func MailboxExistsWithName ¶
func MarkMessageAsDeleted ¶ added in v0.14.0
func NewFlagSet ¶
func ReadResult ¶
func RemoveMessageFlag ¶
func RemoveMessagesFromMailbox ¶
func RemoveMessagesFromMailbox(ctx context.Context, tx *ent.Tx, messageIDs []imap.InternalMessageID, mboxID imap.InternalMailboxID) error
func SetDeletedFlag ¶
func SetDeletedFlag(ctx context.Context, tx *ent.Tx, mboxID imap.InternalMailboxID, messageIDs []imap.InternalMessageID, deleted bool) error
func SetMessageFlags ¶
func UpdateRemoteMailboxID ¶
func UpdateRemoteMessageID ¶
Types ¶
type CreateMessageReq ¶
type MessageFlagSet ¶
type MessageFlagSet struct { ID imap.InternalMessageID FlagSet imap.FlagSet }
func GetMessageFlags ¶
func GetMessageFlags(ctx context.Context, client *ent.Client, messageIDs []imap.InternalMessageID) ([]MessageFlagSet, error)
GetMessageFlags returns the flags of the given messages. It does not include per-mailbox flags (\Deleted, \Recent)!
type SnapshotMessageResult ¶
type SnapshotMessageResult struct { InternalID imap.InternalMessageID `json:"uid_message"` RemoteID imap.MessageID `json:"remote_id"` UID imap.UID `json:"uid"` Recent bool `json:"recent"` Deleted bool `json:"deleted"` Flags string `json:"flags"` }
func GetMailboxMessagesForNewSnapshot ¶
func GetMailboxMessagesForNewSnapshot(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID) ([]SnapshotMessageResult, error)
func (*SnapshotMessageResult) GetFlagSet ¶
func (msg *SnapshotMessageResult) GetFlagSet() imap.FlagSet
type UIDWithFlags ¶
type UIDWithFlags struct { InternalID imap.InternalMessageID `json:"uid_message"` RemoteID imap.MessageID `json:"remote_id"` UID imap.UID `json:"uid"` Recent bool `json:"recent"` Deleted bool `json:"deleted"` Flags string `json:"flags"` }
func AddMessagesToMailbox ¶
func AddMessagesToMailbox(ctx context.Context, tx *ent.Tx, messageIDs []imap.InternalMessageID, mboxID imap.InternalMailboxID) ([]UIDWithFlags, error)
func BumpMailboxUIDsForMessage ¶
func BumpMailboxUIDsForMessage(ctx context.Context, tx *ent.Tx, messageIDs []imap.InternalMessageID, mboxID imap.InternalMailboxID) ([]UIDWithFlags, error)
func GetMessageUIDsWithFlagsAfterAddOrUIDBump ¶
func GetMessageUIDsWithFlagsAfterAddOrUIDBump(ctx context.Context, client *ent.Client, mboxID imap.InternalMailboxID, messageIDs []imap.InternalMessageID) ([]UIDWithFlags, error)
GetMessageUIDsWithFlagsAfterAddOrUIDBump exploits a property of adding a message to or bumping the UIDs of existing message in mailbox. It can only be used if you can guarantee that the messageID list contains only IDs that have recently added or bumped in the mailbox.
func (*UIDWithFlags) GetFlagSet ¶
func (u *UIDWithFlags) GetFlagSet() imap.FlagSet
Click to show internal directories.
Click to hide internal directories.