models

package
v0.0.0-...-fb7ad71 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DbCfg struct {
		Type, Path string
	}
)

Functions

func CreateMail

func CreateMail(raw *RawMailItem) (mail *Mail, recipients []MailRecipient, err error)

func LoadConfigs

func LoadConfigs()

func NewEngine

func NewEngine() (err error)

func SetEngine

func SetEngine() (err error)

Types

type Attachment

type Attachment struct {
	Id          int64
	MailId      int64
	FileName    string
	ContentType string
	Data        string `xorm:"TEXT"`

	Received     time.Time `xorm:"created"`
	ReceivedUnix int64     `xorm:"created"`
}

func CreateAttachment

func CreateAttachment(e *xorm.Session, attachment *Attachment) (*Attachment, error)

type Cleaner

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

type EmbeddedFile

type EmbeddedFile struct {
	Id          int64
	MailId      int64
	ContentId   string
	ContentType string
	Data        string `xorm:"TEXT"`

	Received     time.Time `xorm:"created"`
	ReceivedUnix int64     `xorm:"created"`
}

func CreateEmbeddedFile

func CreateEmbeddedFile(e *xorm.Session, file *EmbeddedFile) (*EmbeddedFile, error)

func GetEmbeddedFile

func GetEmbeddedFile(mailId int64, contentId string) (embeddedFile *EmbeddedFile, has bool, err error)

type Engine

type Engine interface {
	Get(interface{}) (bool, error)
	Insert(...interface{}) (int64, error)
	Count(interface{}) (int64, error)
}

Engine represents a XORM engine or session.

type Mail

type Mail struct {
	Id      int64
	From    string
	Subject string
	Body    string `xorm:"TEXT"`

	Received     time.Time `xorm:"created"`
	ReceivedUnix int64     `xorm:"created"`
	Sent         time.Time
	SentUnix     int64
}

func GetMail

func GetMail(username string) ([]*Mail, error)

func (*Mail) AfterLoad

func (m *Mail) AfterLoad()

func (*Mail) AfterSet

func (m *Mail) AfterSet(colName string, _ xorm.Cell)

func (*Mail) String

func (m *Mail) String() string

type MailRecipient

type MailRecipient struct {
	Id          int64
	MailId      int64
	RecipientId int64 `xorm:"INDEX"`
}

func (*MailRecipient) String

func (m *MailRecipient) String() string

type RawMailItem

type RawMailItem struct {
	From      string
	Recipient []string
	Data      string
	Complete  bool
}

type User

type User struct {
	Id   int64
	Name string `xorm:"UNIQUE NOT NULL"`

	Created     time.Time `xorm:"created"`
	CreatedUnix int64     `xorm:"created"`
}

func GetOrCreateUserByName

func GetOrCreateUserByName(e *xorm.Session, name string) (user *User, err error)

Jump to

Keyboard shortcuts

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