Versions in this module Expand all Collapse all v1 v1.0.0 Jan 30, 2026 Changes in this version + const DefaultPhotoTTL + const ResourceCalendars + const ResourceContacts + const ResourceEmails + const ResourceEvents + const ResourceFolders + func IsEncrypted(dbPath string) (bool, error) + func OpenSharedDB(basePath, filename string) (*sql.DB, error) + type ActionType string + const ActionArchive + const ActionCreateContact + const ActionCreateEvent + const ActionDelete + const ActionDeleteContact + const ActionDeleteDraft + const ActionDeleteEvent + const ActionMarkRead + const ActionMarkUnread + const ActionMove + const ActionSaveDraft + const ActionSend + const ActionStar + const ActionUnstar + const ActionUpdateContact + const ActionUpdateEvent + type AttachmentCacheStats struct + Count int + MaxSize int64 + Newest time.Time + Oldest time.Time + TotalSize int64 + Usage float64 + type AttachmentStore struct + func NewAttachmentStore(db *sql.DB, basePath string, maxSizeMB int) (*AttachmentStore, error) + func (s *AttachmentStore) Count() (int, error) + func (s *AttachmentStore) Delete(id string) error + func (s *AttachmentStore) DeleteByEmail(emailID string) error + func (s *AttachmentStore) Get(id string) (*CachedAttachment, error) + func (s *AttachmentStore) GetByHash(hash string) (*CachedAttachment, error) + func (s *AttachmentStore) GetStats() (*AttachmentCacheStats, error) + func (s *AttachmentStore) LRUEvict(bytesToFree int64) (int, error) + func (s *AttachmentStore) ListByEmail(emailID string) ([]*CachedAttachment, error) + func (s *AttachmentStore) Open(id string) (*os.File, error) + func (s *AttachmentStore) Prune() (int, error) + func (s *AttachmentStore) Put(attachment *CachedAttachment, content io.Reader) error + func (s *AttachmentStore) RemoveOrphaned() (int, error) + func (s *AttachmentStore) TotalSize() (int64, error) + type CacheStats struct + ContactCount int + Email string + EmailCount int + EventCount int + LastSync time.Time + SizeBytes int64 + type CachedAttachment struct + AccessedAt time.Time + CachedAt time.Time + ContentType string + EmailID string + Filename string + Hash string + ID string + LocalPath string + Size int64 + type CachedCalendar struct + CachedAt time.Time + Description string + HexColor string + ID string + IsPrimary bool + Name string + ReadOnly bool + type CachedContact struct + CachedAt time.Time + Company string + DisplayName string + Email string + GivenName string + Groups []string + ID string + JobTitle string + Notes string + Phone string + PhotoURL string + Surname string + type CachedEmail struct + BCC []string + BodyHTML string + BodyText string + CC []string + CachedAt time.Time + Date time.Time + FolderID string + FromEmail string + FromName string + HasAttachments bool + ID string + Snippet string + Starred bool + Subject string + ThreadID string + To []string + Unread bool + type CachedEvent struct + AllDay bool + Busy bool + CachedAt time.Time + CalendarID string + Description string + EndTime time.Time + ID string + Location string + Participants []string + RRule string + Recurring bool + StartTime time.Time + Status string + Title string + type CachedFolder struct + CachedAt time.Time + ID string + Name string + TotalCount int + Type string + UnreadCount int + type CachedPhoto struct + AccessedAt time.Time + CachedAt time.Time + ContactID string + ContentType string + LocalPath string + Size int64 + type CalendarStore struct + func NewCalendarStore(db *sql.DB) *CalendarStore + func (s *CalendarStore) Count() (int, error) + func (s *CalendarStore) Delete(id string) error + func (s *CalendarStore) Get(id string) (*CachedCalendar, error) + func (s *CalendarStore) GetPrimary() (*CachedCalendar, error) + func (s *CalendarStore) List() ([]*CachedCalendar, error) + func (s *CalendarStore) ListWritable() ([]*CachedCalendar, error) + func (s *CalendarStore) Put(calendar *CachedCalendar) error + func (s *CalendarStore) PutBatch(calendars []*CachedCalendar) error + type Config struct + BasePath string + MaxSizeMB int + SyncIntervalMinutes int + TTLDays int + func DefaultConfig() Config + type ContactListOptions struct + Group string + Limit int + Offset int + type ContactStore struct + func NewContactStore(db *sql.DB) *ContactStore + func (s *ContactStore) Count() (int, error) + func (s *ContactStore) Delete(id string) error + func (s *ContactStore) Get(id string) (*CachedContact, error) + func (s *ContactStore) GetByEmail(email string) (*CachedContact, error) + func (s *ContactStore) List(opts ContactListOptions) ([]*CachedContact, error) + func (s *ContactStore) ListGroups() ([]string, error) + func (s *ContactStore) Put(contact *CachedContact) error + func (s *ContactStore) PutBatch(contacts []*CachedContact) error + func (s *ContactStore) Search(query string, limit int) ([]*CachedContact, error) + type DraftPayload struct + BCC []string + Body string + CC []string + DraftID string + Subject string + To []string + type EmailStore struct + func NewEmailStore(db *sql.DB) *EmailStore + func (s *EmailStore) Count() (int, error) + func (s *EmailStore) CountUnread() (int, error) + func (s *EmailStore) Delete(id string) error + func (s *EmailStore) Get(id string) (*CachedEmail, error) + func (s *EmailStore) List(opts ListOptions) ([]*CachedEmail, error) + func (s *EmailStore) Put(email *CachedEmail) error + func (s *EmailStore) PutBatch(emails []*CachedEmail) error + func (s *EmailStore) Search(query string, limit int) ([]*CachedEmail, error) + func (s *EmailStore) SearchAdvanced(query string, limit int) ([]*CachedEmail, error) + func (s *EmailStore) SearchWithQuery(sq *SearchQuery, limit int) ([]*CachedEmail, error) + func (s *EmailStore) UpdateFlags(id string, unread, starred *bool) error + type EncryptedManager struct + func NewEncryptedManager(cfg Config, encCfg EncryptionConfig) (*EncryptedManager, error) + func (m *EncryptedManager) ClearCache(email string) error + func (m *EncryptedManager) GetDB(email string) (*sql.DB, error) + func (m *EncryptedManager) MigrateToEncrypted(email string) error + func (m *EncryptedManager) MigrateToUnencrypted(email string) error + type EncryptionConfig struct + Enabled bool + KeyID string + type EventListOptions struct + CalendarID string + End time.Time + Limit int + Offset int + Start time.Time + type EventStore struct + func NewEventStore(db *sql.DB) *EventStore + func (s *EventStore) Count() (int, error) + func (s *EventStore) Delete(id string) error + func (s *EventStore) DeleteByCalendar(calendarID string) error + func (s *EventStore) Get(id string) (*CachedEvent, error) + func (s *EventStore) GetUpcoming(limit int) ([]*CachedEvent, error) + func (s *EventStore) List(opts EventListOptions) ([]*CachedEvent, error) + func (s *EventStore) ListByDateRange(start, end time.Time) ([]*CachedEvent, error) + func (s *EventStore) Put(event *CachedEvent) error + func (s *EventStore) PutBatch(events []*CachedEvent) error + func (s *EventStore) Search(query string, limit int) ([]*CachedEvent, error) + type FolderStore struct + func NewFolderStore(db *sql.DB) *FolderStore + func (s *FolderStore) Count() (int, error) + func (s *FolderStore) Delete(id string) error + func (s *FolderStore) Get(id string) (*CachedFolder, error) + func (s *FolderStore) GetByType(folderType string) (*CachedFolder, error) + func (s *FolderStore) GetTotalUnread() (int, error) + func (s *FolderStore) IncrementUnread(id string, delta int) error + func (s *FolderStore) List() ([]*CachedFolder, error) + func (s *FolderStore) Put(folder *CachedFolder) error + func (s *FolderStore) PutBatch(folders []*CachedFolder) error + func (s *FolderStore) UpdateCounts(id string, unreadCount, totalCount int) error + type ListOptions struct + Before time.Time + FolderID string + Limit int + Offset int + Since time.Time + StarredOnly bool + ThreadID string + UnreadOnly bool + type Manager struct + func NewManager(cfg Config) (*Manager, error) + func (m *Manager) ClearAllCaches() error + func (m *Manager) ClearCache(email string) error + func (m *Manager) Close() error + func (m *Manager) CloseDB(email string) error + func (m *Manager) DBPath(email string) string + func (m *Manager) GetDB(email string) (*sql.DB, error) + func (m *Manager) GetStats(email string) (*CacheStats, error) + func (m *Manager) ListCachedAccounts() ([]string, error) + type MarkReadPayload struct + EmailID string + Unread bool + type MovePayload struct + EmailID string + FolderID string + type OfflineQueue struct + func NewOfflineQueue(db *sql.DB) (*OfflineQueue, error) + func (q *OfflineQueue) Clear() error + func (q *OfflineQueue) Count() (int, error) + func (q *OfflineQueue) Dequeue() (*QueuedAction, error) + func (q *OfflineQueue) Enqueue(actionType ActionType, resourceID string, payload any) error + func (q *OfflineQueue) HasPendingActions() (bool, error) + func (q *OfflineQueue) List() ([]*QueuedAction, error) + func (q *OfflineQueue) MarkFailed(id int64, err error) error + func (q *OfflineQueue) Peek() (*QueuedAction, error) + func (q *OfflineQueue) Remove(id int64) error + func (q *OfflineQueue) RemoveByResourceID(resourceID string) error + func (q *OfflineQueue) RemoveStale(maxAge time.Duration) (int, error) + type PhotoCacheStats struct + Count int + Newest time.Time + Oldest time.Time + TTLDays int + TotalSize int64 + type PhotoStore struct + func NewPhotoStore(db *sql.DB, basePath string, ttl time.Duration) (*PhotoStore, error) + func (s *PhotoStore) Count() (int, error) + func (s *PhotoStore) Delete(contactID string) error + func (s *PhotoStore) Get(contactID string) ([]byte, string, error) + func (s *PhotoStore) GetStats() (*PhotoCacheStats, error) + func (s *PhotoStore) IsValid(contactID string) bool + func (s *PhotoStore) Prune() (int, error) + func (s *PhotoStore) Put(contactID, contentType string, data []byte) error + func (s *PhotoStore) RemoveOrphaned() (int, error) + func (s *PhotoStore) TotalSize() (int64, error) + type QueuedAction struct + Attempts int + CreatedAt time.Time + ID int64 + LastError string + Payload string + ResourceID string + Type ActionType + func (a *QueuedAction) GetActionData(v any) error + type SearchQuery struct + After time.Time + Before time.Time + From string + HasAttachment *bool + In string + IsStarred *bool + IsUnread *bool + Subject string + Text string + To string + func ParseSearchQuery(query string) *SearchQuery + type SendEmailPayload struct + BCC []string + Body string + CC []string + ReplyTo string + Subject string + To []string + type Settings struct + AttachmentCacheEnabled bool + AttachmentMaxSizeMB int + BackgroundSyncEnabled bool + CompactMode bool + DefaultView string + Enabled bool + EncryptionEnabled bool + InitialSyncDays int + MaxSizeMB int + OfflineQueueEnabled bool + PreviewPosition string + SyncIntervalMinutes int + TTLDays int + Theme string + func DefaultSettings() *Settings + func LoadSettings(basePath string) (*Settings, error) + func (s *Settings) Get() Settings + func (s *Settings) GetMaxSizeBytes() int64 + func (s *Settings) GetSyncInterval() time.Duration + func (s *Settings) GetTTL() time.Duration + func (s *Settings) IsCacheEnabled() bool + func (s *Settings) IsEncryptionEnabled() bool + func (s *Settings) Reset() error + func (s *Settings) Save() error + func (s *Settings) SetEnabled(enabled bool) error + func (s *Settings) SetEncryption(enabled bool) error + func (s *Settings) SetMaxSize(sizeMB int) error + func (s *Settings) SetTheme(theme string) error + func (s *Settings) ToConfig(basePath string) Config + func (s *Settings) ToEncryptionConfig() EncryptionConfig + func (s *Settings) Update(fn func(*Settings)) error + func (s *Settings) Validate() error + type StarPayload struct + EmailID string + Starred bool + type SyncState struct + Cursor string + LastSync time.Time + Metadata map[string]string + Resource string + type SyncStore struct + func NewSyncStore(db *sql.DB) *SyncStore + func (s *SyncStore) Delete(resource string) error + func (s *SyncStore) Get(resource string) (*SyncState, error) + func (s *SyncStore) MarkSynced(resource string) error + func (s *SyncStore) NeedsSync(resource string, maxAge time.Duration) (bool, error) + func (s *SyncStore) Set(state *SyncState) error + func (s *SyncStore) UpdateCursor(resource, cursor string) error + type UnifiedSearchResult struct + Date time.Time + ID string + Subtitle string + Title string + Type string + func UnifiedSearch(db *sql.DB, query string, limit int) ([]*UnifiedSearchResult, error)