repository

package
v0.2.24 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSenderNotFound      = errors.New("sender not found")
	ErrEmailNotFound       = errors.New("email not found")
	ErrSenderAlreadyExists = errors.New("sender already exists")
	ErrInvalidInput        = errors.New("invalid input parameters")
)

Functions

func MigrateDataWarehouse added in v0.2.9

func MigrateDataWarehouse(dbConfig *config.DataWarehouseConfig, warehouseDB *gorm.DB) error

func MigrateMailstackDB added in v0.0.15

func MigrateMailstackDB(dbConfig *config.MailstackDatabaseConfig, mailstackDB *gorm.DB) error

func NewEmailAttachmentRepository

func NewEmailAttachmentRepository(db *gorm.DB, storageService interfaces.StorageService) interfaces.EmailAttachmentRepository

func NewEmailEventRepository added in v0.2.4

func NewEmailEventRepository(db *gorm.DB) interfaces.EmailEventRepository

func NewEmailLogRepository added in v0.2.5

func NewEmailLogRepository(db *gorm.DB) interfaces.EmailLogRepository

func NewEmailRepository

func NewEmailRepository(db *gorm.DB) interfaces.EmailRepository

func NewEmailThreadRepository added in v0.0.3

func NewEmailThreadRepository(db *gorm.DB) interfaces.EmailThreadRepository

NewEmailThreadRepository creates a new email thread repository

func NewMailboxRepository

func NewMailboxRepository(db *gorm.DB) interfaces.MailboxRepository

func NewMailboxSyncRepository

func NewMailboxSyncRepository(db *gorm.DB) interfaces.MailboxSyncRepository

func NewOrphanEmailRepository added in v0.0.3

func NewOrphanEmailRepository(db *gorm.DB) interfaces.OrphanEmailRepository

NewOrphanEmailRepository creates a new orphan email repository

Types

type DomainRepository added in v0.0.3

type DomainRepository interface {
	RegisterDomain(ctx context.Context, tenant, domain string) (*models.MailStackDomain, error)
	CheckDomainOwnership(ctx context.Context, tenant, domain string) (bool, error)
	GetDomain(ctx context.Context, tenant, domain string) (*models.MailStackDomain, error)
	GetActiveDomains(ctx context.Context, tenant string) ([]models.MailStackDomain, error)
	MarkConfigured(ctx context.Context, tenant, domain string) error
	SetDkimKeys(ctx context.Context, tenant, domain, dkimPublic, dkimPrivate string) error
	CreateDMARCReport(ctx context.Context, tenant string, report *models.DMARCMonitoring) error
	CreateMailstackReputationScore(ctx context.Context, tenant string, score *models.MailstackReputation) error
	GetDomainCrossTenant(ctx context.Context, domain string) (*models.MailStackDomain, error)
	GetAllActiveDomainsCrossTenant(ctx context.Context) ([]models.MailStackDomain, error)
}

func NewDomainRepository added in v0.0.3

func NewDomainRepository(db *gorm.DB) DomainRepository

type GormSenderRepository added in v0.0.22

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

GormSenderRepository implements SenderRepository using GORM

func (*GormSenderRepository) Create added in v0.0.22

func (r *GormSenderRepository) Create(ctx context.Context, sender *models.Sender) error

Create adds a new sender to the database

func (*GormSenderRepository) Delete added in v0.0.22

func (r *GormSenderRepository) Delete(ctx context.Context, id string) error

Delete removes a sender from the database

func (*GormSenderRepository) GetByID added in v0.0.22

func (r *GormSenderRepository) GetByID(ctx context.Context, id string) (*models.Sender, error)

GetByID retrieves a sender by its ID

func (*GormSenderRepository) GetByUserID added in v0.0.22

func (r *GormSenderRepository) GetByUserID(ctx context.Context, userID string) ([]models.Sender, error)

GetByUserID retrieves all senders for a specific user

func (*GormSenderRepository) GetDefaultForUser added in v0.0.22

func (r *GormSenderRepository) GetDefaultForUser(ctx context.Context, userID string) (*models.Sender, error)

GetDefaultForUser retrieves the default sender for a specific user

func (*GormSenderRepository) ListByTenant added in v0.0.22

func (r *GormSenderRepository) ListByTenant(ctx context.Context, tenant string, limit, offset int) ([]models.Sender, int64, error)

ListByTenant retrieves all senders for a specific tenant with pagination

func (*GormSenderRepository) SetActive added in v0.0.22

func (r *GormSenderRepository) SetActive(ctx context.Context, id string, isActive bool) error

SetActive sets the active status of a sender

func (*GormSenderRepository) SetDefault added in v0.0.22

func (r *GormSenderRepository) SetDefault(ctx context.Context, id string, userID string) error

SetDefault sets a sender as the default for a user

func (*GormSenderRepository) Update added in v0.0.22

func (r *GormSenderRepository) Update(ctx context.Context, sender *models.Sender) error

Update updates an existing sender

type Repositories

type Repositories struct {
	DomainRepository          DomainRepository
	EmailRepository           interfaces.EmailRepository
	EmailAttachmentRepository interfaces.EmailAttachmentRepository
	EmailEventRepository      interfaces.EmailEventRepository
	EmailLogRepository        interfaces.EmailLogRepository
	EmailThreadRepository     interfaces.EmailThreadRepository
	MailboxRepository         interfaces.MailboxRepository
	MailboxSyncRepository     interfaces.MailboxSyncRepository
	OrphanEmailRepository     interfaces.OrphanEmailRepository
	SenderRepository          interfaces.SenderRepository
}

func InitRepositories

func InitRepositories(mailstackDB *gorm.DB, timescaleDB *gorm.DB, r2Config *config.R2StorageConfig) *Repositories

type SenderRepository added in v0.0.22

type SenderRepository interface {
	Create(ctx context.Context, sender *models.Sender) error
	GetByID(ctx context.Context, id string) (*models.Sender, error)
	GetByUserID(ctx context.Context, userID string) ([]models.Sender, error)
	GetDefaultForUser(ctx context.Context, userID string) (*models.Sender, error)
	Update(ctx context.Context, sender *models.Sender) error
	SetDefault(ctx context.Context, id string, userID string) error
	SetActive(ctx context.Context, id string, isActive bool) error
	Delete(ctx context.Context, id string) error
	ListByTenant(ctx context.Context, tenant string, limit, offset int) ([]models.Sender, int64, error)
}

SenderRepository defines the interface for sender data operations

func NewSenderRepository added in v0.0.22

func NewSenderRepository(db *gorm.DB) SenderRepository

NewSenderRepository creates a new sender repository instance

Jump to

Keyboard shortcuts

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