backend

package
v0.0.0-...-547b272 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2018 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvToBackendEmailOperation

func ConvToBackendEmailOperation(t string) backend.EmailOperation

func ConvToBackendFolderOperation

func ConvToBackendFolderOperation(t string) backend.FolderOperation

func ConvToBackendFolderType

func ConvToBackendFolderType(t string) backend.FolderType

func ConvToEmailOperationString

func ConvToEmailOperationString(t backend.EmailOperation) string

func ConvToFolderOperationString

func ConvToFolderOperationString(t backend.FolderOperation) string

func ConvToFolderTypeString

func ConvToFolderTypeString(t backend.FolderType) string

func New

func New(dbName string) *storage

New returns storage that implements the backend.Storage interface.

Types

type Attachment

type Attachment struct {
	// contains filtered or unexported fields
}

func (*Attachment) ContentID

func (r *Attachment) ContentID() string

func (*Attachment) ContentType

func (r *Attachment) ContentType() string

func (*Attachment) ID

func (r *Attachment) ID() uint64

func (*Attachment) IsInline

func (r *Attachment) IsInline() bool

func (*Attachment) Name

func (r *Attachment) Name() string

func (*Attachment) Size

func (r *Attachment) Size() uint64

func (*Attachment) Value

func (r *Attachment) Value() ([]byte, error)

type EmailHistory

type EmailHistory struct {
	// contains filtered or unexported fields
}

func (*EmailHistory) ID

func (e *EmailHistory) ID() uint64

func (*EmailHistory) Operation

func (e *EmailHistory) Operation() backend.EmailOperation

func (*EmailHistory) Timestamp

func (e *EmailHistory) Timestamp() time.Time

func (*EmailHistory) Value

func (e *EmailHistory) Value() (*backend.Email, error)

type EmailStorage

type EmailStorage struct {
	// contains filtered or unexported fields
}

func (*EmailStorage) AddEmail

func (r *EmailStorage) AddEmail(rawEmail []byte) (email *backend.Email, err error)

AddEmail should add a new email history.

func (*EmailStorage) Credential

func (r *EmailStorage) Credential() backend.Credential

func (*EmailStorage) DeleteEmail

func (r *EmailStorage) DeleteEmail(emailID uint64) error

DeleteEmail should add a new email history.

func (*EmailStorage) DeleteEmailHistory

func (r *EmailStorage) DeleteEmailHistory(historyID uint64) error

func (*EmailStorage) FolderID

func (r *EmailStorage) FolderID() uint64

func (*EmailStorage) GetAttachment

func (r *EmailStorage) GetAttachment(attID uint64) (attach backend.Attachment, err error)

func (*EmailStorage) GetEmail

func (r *EmailStorage) GetEmail(emailID uint64, lock database.LockMode) (v *backend.Email, err error)

func (*EmailStorage) GetEmailHistories

func (r *EmailStorage) GetEmailHistories(offset, limit uint64, desc bool, lock database.LockMode) (histories []backend.EmailHistory, err error)

offset is a history ID as a starting position. desc means descending order if it is true, otherwise ascending order. Zero offset means the last item if desc is true.

func (*EmailStorage) GetEmails

func (r *EmailStorage) GetEmails(offset, limit uint64, desc bool, lock database.LockMode) (emails []*backend.Email, err error)

func (*EmailStorage) GetLastEmailHistory

func (r *EmailStorage) GetLastEmailHistory(emailID uint64, lock database.LockMode) (history backend.EmailHistory, err error)

func (*EmailStorage) GetNumEmailHistories

func (r *EmailStorage) GetNumEmailHistories(offset uint64, duration time.Duration, desc bool) (count uint64, err error)

GetNumEmailHistories returns the number of email histories whose email's timestamp is within range from current time. offset is an history ID as a starting position. desc means descending order if it is true, otherwise ascending order.

func (*EmailStorage) GetNumEmails

func (r *EmailStorage) GetNumEmails(offset uint64, duration time.Duration, desc bool) (count uint64, err error)

func (*EmailStorage) GetRawEmail

func (r *EmailStorage) GetRawEmail(emailID uint64, lock database.LockMode) (v []byte, err error)

func (*EmailStorage) MoveEmail

func (r *EmailStorage) MoveEmail(emailID, newFolderID uint64) (newEmailID uint64, err error)

MoveEmail should add a new email history. MoveEmail is a helper function to serialize delete and add functions.

func (*EmailStorage) MoveToTrash

func (r *EmailStorage) MoveToTrash(emailID uint64) (newEmailID, trashFolderID uint64, err error)

func (*EmailStorage) UpdateEmail

func (r *EmailStorage) UpdateEmail(emailID uint64, read bool) error

UpdateEmail should add a new email history.

type FolderHistory

type FolderHistory struct {
	// contains filtered or unexported fields
}

func (*FolderHistory) ID

func (e *FolderHistory) ID() uint64

func (*FolderHistory) Operation

func (e *FolderHistory) Operation() backend.FolderOperation

func (*FolderHistory) Timestamp

func (e *FolderHistory) Timestamp() time.Time

func (*FolderHistory) Value

func (e *FolderHistory) Value() (backend.Folder, error)

type FolderStorage

type FolderStorage struct {
	// contains filtered or unexported fields
}

func (*FolderStorage) AddFolder

func (r *FolderStorage) AddFolder(parentID uint64, name string, t backend.FolderType) (folderID uint64, err error)

AddFolder should add a new folder history.

func (*FolderStorage) Credential

func (r *FolderStorage) Credential() backend.Credential

func (*FolderStorage) DeleteFolder

func (r *FolderStorage) DeleteFolder(folderID uint64) error

DeleteFolder should add a new folder history.

func (*FolderStorage) DeleteFolderHistory

func (r *FolderStorage) DeleteFolderHistory(historyID uint64) error

func (*FolderStorage) GetFolderByID

func (r *FolderStorage) GetFolderByID(folderID uint64, lock database.LockMode) (v backend.Folder, err error)

func (*FolderStorage) GetFolderByName

func (r *FolderStorage) GetFolderByName(parentID uint64, name string, recursive bool, lock database.LockMode) (folders []backend.Folder, err error)

func (*FolderStorage) GetFolderByPath

func (r *FolderStorage) GetFolderByPath(path []string, lock database.LockMode) (folder backend.Folder, err error)

func (*FolderStorage) GetFolderByType

func (r *FolderStorage) GetFolderByType(t backend.FolderType, lock database.LockMode) (folders []backend.Folder, err error)

func (*FolderStorage) GetFolderHistories

func (r *FolderStorage) GetFolderHistories(offset, limit uint64, desc bool, lock database.LockMode) (histories []backend.FolderHistory, err error)

offset is a folder history ID as a starting position. desc means descending order if it is true, otherwise ascending order. Zero offset means the last item if desc is true. Zero limit means infinite.

func (*FolderStorage) GetFolders

func (r *FolderStorage) GetFolders(lock database.LockMode) (folders []backend.Folder, err error)

func (*FolderStorage) GetLastFolderHistory

func (r *FolderStorage) GetLastFolderHistory(folderID uint64, lock database.LockMode) (history backend.FolderHistory, err error)

func (*FolderStorage) UpdateFolder

func (r *FolderStorage) UpdateFolder(folderID, newParentID uint64, newName string) error

UpdateFolder should add a new folder history.

Jump to

Keyboard shortcuts

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