repository

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyRepository

type APIKeyRepository interface {
	Create(apiKey *domain.APIKey) error
	GetByKeyHash(keyHash string) (*domain.APIKey, error)
	GetByID(id int64) (*domain.APIKey, error)
	ListByUser(userID int64) ([]*domain.APIKey, error)
	UpdateLastUsed(id int64, ip string) error
	Delete(id int64) error
}

APIKeyRepository defines API key data access interface

type AliasRepository

type AliasRepository interface {
	Create(alias *domain.Alias) error
	GetByID(id int64) (*domain.Alias, error)
	GetByEmail(email string) (*domain.Alias, error)
	Update(alias *domain.Alias) error
	Delete(id int64) error
	ListAll() ([]*domain.Alias, error)
	ListByDomain(domainID int64) ([]*domain.Alias, error)
	// Pagination methods
	List(offset, limit int) ([]*domain.Alias, error)
	Count() (int64, error)
	CountByDomain(domainID int64) (int64, error)
}

AliasRepository defines alias data access interface

type DKIMRepository

type DKIMRepository interface {
	GetDKIMConfig(domainName string) (*domain.DKIMConfig, error)
}

DKIMRepository defines DKIM configuration access interface

type DomainRepository

type DomainRepository interface {
	Create(domain *domain.Domain) error
	GetByID(id int64) (*domain.Domain, error)
	GetByName(name string) (*domain.Domain, error)
	Update(domain *domain.Domain) error
	Delete(id int64) error
	List(offset, limit int) ([]*domain.Domain, error)
}

DomainRepository defines domain data access interface

type GreylistRepository

type GreylistRepository interface {
	Create(ip, sender, recipient string) (*domain.GreylistTriplet, error)
	Get(ip, sender, recipient string) (*domain.GreylistTriplet, error)
	IncrementPass(id int64) error
	DeleteOlderThan(age time.Duration) error
}

GreylistRepository defines greylist data access interface

type IPBlacklistRepository

type IPBlacklistRepository interface {
	Add(ip, reason string, expiresAt *time.Time) error
	IsBlacklisted(ip string) (bool, error)
	Remove(ip string) error
	RemoveExpired() error
}

IPBlacklistRepository defines IP blacklist interface

type LoginAttemptRepository

type LoginAttemptRepository interface {
	Record(ip, email string, success bool) error
	GetRecentFailures(ip string, duration time.Duration) (int, error)
	GetRecentUserFailures(email string, duration time.Duration) (int, error)
	Cleanup(age time.Duration) error
}

LoginAttemptRepository defines login attempt tracking interface

type MailboxRepository

type MailboxRepository interface {
	Create(mailbox *domain.Mailbox) error
	GetByID(id int64) (*domain.Mailbox, error)
	GetByUser(userID int64) ([]*domain.Mailbox, error)
	GetByName(userID int64, name string) (*domain.Mailbox, error)
	Update(mailbox *domain.Mailbox) error
	Delete(id int64) error
}

MailboxRepository defines mailbox data access interface

type MessageRepository

type MessageRepository interface {
	Create(message *domain.Message) error
	GetByID(id int64) (*domain.Message, error)
	GetByMailbox(mailboxID int64, offset, limit int) ([]*domain.Message, error)
	Update(message *domain.Message) error
	Delete(id int64) error
}

MessageRepository defines message data access interface

type QuarantineRepository

type QuarantineRepository interface {
	Create(message *domain.QuarantineMessage) error
	GetByID(id int64) (*domain.QuarantineMessage, error)
	List(offset, limit int) ([]*domain.QuarantineMessage, error)
	UpdateAction(id int64, action string) error
	Delete(id int64) error
	DeleteOlderThan(age time.Duration) error
}

QuarantineRepository defines quarantine data access interface

type QueueRepository

type QueueRepository interface {
	Enqueue(item *domain.QueueItem) error
	GetPending() ([]*domain.QueueItem, error)
	GetByID(id int64) (*domain.QueueItem, error)
	UpdateStatus(id int64, status string, errorMsg string) error
	UpdateRetry(id int64, retryCount int, nextRetry time.Time) error
	Delete(id int64) error
	// Pagination and filtering methods
	List(offset, limit int) ([]*domain.QueueItem, error)
	ListByStatus(status string, offset, limit int) ([]*domain.QueueItem, error)
	Count() (int64, error)
	CountByStatus(status string) (int64, error)
}

QueueRepository defines queue data access interface

type RateLimitRepository

type RateLimitRepository interface {
	Get(key string, limitType string) (*domain.RateLimitEntry, error)
	CreateOrUpdate(entry *domain.RateLimitEntry) error
	Cleanup(windowDuration time.Duration) error
}

RateLimitRepository defines rate limit data access interface

type Repositories

type Repositories struct {
	User         UserRepository
	Domain       DomainRepository
	Message      MessageRepository
	Mailbox      MailboxRepository
	Alias        AliasRepository
	Queue        QueueRepository
	LoginAttempt LoginAttemptRepository
	IPBlacklist  IPBlacklistRepository
	Greylist     GreylistRepository
	RateLimit    RateLimitRepository
	Webhook      WebhookRepository
}

Repositories is a container for all repository implementations

type UserRepository

type UserRepository interface {
	Create(user *domain.User) error
	GetByID(id int64) (*domain.User, error)
	GetByEmail(email string) (*domain.User, error)
	Update(user *domain.User) error
	UpdateLastLogin(id int64) error
	UpdatePassword(userID int64, passwordHash string) error
	Delete(id int64) error
	List(domainID int64, offset, limit int) ([]*domain.User, error)
	ListAll() ([]*domain.User, error)
	// Pagination methods
	ListPaginated(offset, limit int) ([]*domain.User, error)
	Count() (int64, error)
	CountByDomain(domainID int64) (int64, error)
}

UserRepository defines user data access interface

type WebhookRepository

type WebhookRepository interface {
	// Webhook management
	Create(ctx context.Context, webhook *domain.Webhook) error
	GetByID(ctx context.Context, id int64) (*domain.Webhook, error)
	List(ctx context.Context) ([]*domain.Webhook, error)
	ListActive(ctx context.Context) ([]*domain.Webhook, error)
	Update(ctx context.Context, webhook *domain.Webhook) error
	Delete(ctx context.Context, id int64) error

	// Delivery management
	CreateDelivery(ctx context.Context, delivery *domain.WebhookDelivery) error
	GetDeliveryByID(ctx context.Context, id int64) (*domain.WebhookDelivery, error)
	ListDeliveriesByWebhook(ctx context.Context, webhookID int64, limit int) ([]*domain.WebhookDelivery, error)
	ListPendingDeliveries(ctx context.Context, limit int) ([]*domain.WebhookDelivery, error)
	UpdateDelivery(ctx context.Context, delivery *domain.WebhookDelivery) error
	DeleteOldDeliveries(ctx context.Context, olderThan int) error
}

WebhookRepository defines the interface for webhook data access

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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