Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Email ¶
type Email struct {
ID string `gorm:"column:id;type:varchar(50);primaryKey"`
MailboxID string `gorm:"column:mailbox_id;type:varchar(50);index;not null"`
Provider enum.EmailProvider `gorm:"column:provider;type:varchar(50);index;not null"`
Folder string `gorm:"column:folder;type:varchar(100);index;not null"`
ImapUID uint32 `gorm:"column:imap_uid;index"`
MessageID string `gorm:"column:message_id;uniqueIndex;type:varchar(255);not null"`
ThreadID string `gorm:"column:thread_id;type:varchar(255);index"`
InReplyTo string `gorm:"column:in_reply_to;type:varchar(255);index"`
References pq.StringArray `gorm:"column:references;type:text[]"`
// Core email metadata
Subject string `gorm:"column:subject;type:varchar(1000)"`
FromAddress string `gorm:"column:from_address;type:varchar(255);index"`
FromName string `gorm:"column:from_name;type:varchar(255)"`
ReplyTo string `gorm:"column:reply_to;type:varchar(255);index"`
ToAddresses pq.StringArray `gorm:"column:to_addresses;type:text[]"`
CcAddresses pq.StringArray `gorm:"column:cc_addresses;type:text[]"`
BccAddresses pq.StringArray `gorm:"column:bcc_addresses;type:text[]"`
// Time information
SentAt *time.Time `gorm:"column:sent_at;type:timestamp;index"`
ReceivedAt *time.Time `gorm:"column:received_at;type:timestamp;index"`
// Content
BodyText string `gorm:"column:body_text;type:text"`
BodyHTML string `gorm:"column:body_html;type:text"`
HasAttachment bool `gorm:"column:has_attachment;default:false"`
// Extensions and provider-specific data
GmailLabels pq.StringArray `gorm:"column:gmail_labels;type:text[]"`
OutlookCategories pq.StringArray `gorm:"column:outlook_categories;type:text[]"`
MailstackFlags pq.StringArray `gorm:"column:mailstack_flags;type:text[]"`
// Raw data
RawHeaders JSONMap `gorm:"column:raw_headers;type:jsonb"`
Envelope JSONMap `gorm:"column:envelope;type:jsonb"`
BodyStructure JSONMap `gorm:"column:body_structure;type:jsonb"`
// Classification
Classification enum.EmailClassification `gorm:"column:classification;type:varchar(50);index"`
ClassificationReason string `gorm:"column:classification_reason;type:text"`
// Standard timestamps
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:current_timestamp"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:current_timestamp"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index"`
}
Email represents a raw email message stored in the database
func (*Email) Headers ¶
func (e *Email) Headers() (*EmailHeaders, error)
type EmailAttachment ¶
type EmailAttachment struct {
ID string `gorm:"type:varchar(50);primaryKey"`
EmailID string `gorm:"type:varchar(50);index;not null"`
Filename string `gorm:"type:varchar(500)"`
ContentType string `gorm:"type:varchar(255)"`
ContentID string `gorm:"type:varchar(255)"` // For inline attachments
Size int `gorm:"default:0"`
IsInline bool `gorm:"default:false"`
// Storage options
StorageKey string `gorm:"type:varchar(1000)"` // If stored in S3/blob storage
// Standard timestamps
CreatedAt time.Time
UpdatedAt time.Time
}
EmailAttachment represents an attachment to an email
func (*EmailAttachment) BeforeCreate ¶
func (e *EmailAttachment) BeforeCreate(tx *gorm.DB) error
func (EmailAttachment) TableName ¶
func (EmailAttachment) TableName() string
TableName overrides the table name for EmailAttachment
type EmailHeaders ¶
type EmailHeaders struct {
AutoSubmitted bool
ContentDescription string
DeliveryStatus bool
ListUnsubscribe bool
Precedence string
ReturnPath string
ReturnPathExists bool
XAutoreply string
XAutoresponse string
XLoop bool
XFailedRecipients []string
ReplyTo string
ReplyToExists bool
Sender string
ForwardedFor string
DKIM []string
SPF string
DMARC string
}
EmailHeaders represents specific email header information needed for processing
type JSONMap ¶
type JSONMap map[string]interface{}
JSONMap represents a JSON object that can be stored in PostgreSQL
type Mailbox ¶
type Mailbox struct {
ID string `gorm:"column:id;type:varchar(50);primaryKey" json:"id"`
Provider enum.EmailProvider `gorm:"column:provider;type:varchar(50);index;not null" json:"provider"`
// IMAP Configuration
ImapServer string `gorm:"column:imap_server;type:varchar(255);not null" json:"imapServer"`
ImapPort int `gorm:"column:imap_port;not null" json:"imapPort"`
ImapUsername string `gorm:"column:imap_username;type:varchar(255);not null" json:"imapUsername"`
ImapPassword string `gorm:"column:imap_password;type:varchar(255);not null" json:"imapPassword"`
ImapTLS bool `gorm:"column:imap_tls;not null;default:true" json:"imapTls"`
// SMTP Configuration
SmtpServer string `gorm:"column:smtp_server;type:varchar(255);not null" json:"smtpServer"`
SmtpPort int `gorm:"column:smtp_port;not null" json:"smtpPort"`
SmtpUsername string `gorm:"column:smtp_username;type:varchar(255);not null" json:"smtpUsername"`
SmtpPassword string `gorm:"column:smtp_password;type:varchar(255);not null" json:"smtpPassword"`
SmtpTLS bool `gorm:"column:smtp_tls;not null;default:true" json:"smtpTls"`
// Other Configuration
Folders pq.StringArray `gorm:"column:folders;type:text[];not null" json:"folders"`
DisplayName string `gorm:"column:display_name;type:varchar(255)" json:"displayName"`
EmailAddress string `gorm:"column:email_address;type:varchar(255);index" json:"emailAddress"`
// Status Information
LastSynced *time.Time `gorm:"column:last_synced;type:timestamp" json:"lastSynced"`
SyncStatus string `gorm:"column:sync_status;type:varchar(50)" json:"syncStatus"`
ErrorMessage string `gorm:"column:error_message;type:text" json:"errorMessage"`
// Standard timestamps
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:current_timestamp" json:"createdAt"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:current_timestamp" json:"updatedAt"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index" json:"-"`
}
type MailboxSyncState ¶
type MailboxSyncState struct {
ID string `gorm:"column:id;type:uuid;primaryKey;default:gen_random_uuid()"`
MailboxID string `gorm:"column:mailbox_id;type:varchar(50);index;not null"`
FolderName string `gorm:"column:folder_name;type:varchar(100);index;not null"`
LastUID uint32 `gorm:"column:last_uid;not null"`
LastSync time.Time `gorm:"column:last_sync;type:timestamp;not null"`
CreatedAt time.Time `gorm:"column:created_at;type:timestamp;default:current_timestamp"`
UpdatedAt time.Time `gorm:"column:updated_at;type:timestamp;default:current_timestamp"`
}
MailboxSyncState represents the synchronization state for a mailbox folder
func (MailboxSyncState) TableName ¶
func (MailboxSyncState) TableName() string
Click to show internal directories.
Click to hide internal directories.