Versions in this module Expand all Collapse all v0 v0.2.0 Apr 3, 2026 Changes in this version type ImportHistory + DownloadID *string type ImportQueueItem + DownloadID *string type QueueRepository + func (r *QueueRepository) ClearProviderHourlyStats(ctx context.Context) error type Repository + func (r *Repository) AddProviderBytesToHourlyStat(ctx context.Context, providerID string, bytes int64) error + func (r *Repository) ClearProviderHourlyStats(ctx context.Context) error + func (r *Repository) GetImportHistoryByDownloadID(ctx context.Context, downloadID string) (*ImportHistory, error) + func (r *Repository) GetImportHistoryItem(ctx context.Context, id int64) (*ImportHistory, error) + func (r *Repository) GetProviderHourlyStats(ctx context.Context, hours int) (map[string]int64, error) + func (r *Repository) GetQueueItemByDownloadID(ctx context.Context, downloadID string) (*ImportQueueItem, error) + func (r *Repository) RemoveFromHistoryByDownloadID(ctx context.Context, downloadID string) (int64, error) + func (r *Repository) RemoveFromQueueByDownloadID(ctx context.Context, downloadID string) error v0.1.0 Mar 24, 2026 Changes in this version + type AutomaticHealthCheckRecord struct + FilePath string + LibraryPath *string + MaxRepairRetries int + MaxRetries int + ReleaseDate *time.Time + ScheduledCheckAt *time.Time + SourceNzbPath *string + Status HealthStatus + type BackfillRecord struct + FilePath string + ID int64 + type BackfillUpdate struct + ID int64 + ReleaseDate time.Time + ScheduledCheckAt time.Time + type BulkOperationResult struct + DeletedCount int + FailedIDs []int64 + ProcessingCount int + type Config struct + DSN string + DatabasePath string + Type string + type DB struct + Repository *QueueRepository + func NewDB(config Config) (*DB, error) + func (db *DB) Close() error + func (db *DB) Connection() *sql.DB + func (db *DB) Dialect() Dialect + func (db *DB) UpdateConnectionPool(workerCount int) + type DBQuerier interface + ExecContext func(ctx context.Context, query string, args ...any) (sql.Result, error) + QueryContext func(ctx context.Context, query string, args ...any) (*sql.Rows, error) + QueryRowContext func(ctx context.Context, query string, args ...any) *sql.Row + type Dialect string + const DialectPostgres + const DialectSQLite + type FileHealth struct + CreatedAt time.Time + ErrorDetails *string + FilePath string + ID int64 + IsMasked bool + LastChecked *time.Time + LastError *string + LibraryPath *string + MaxRepairRetries int + MaxRetries int + Priority HealthPriority + ReleaseDate *time.Time + RepairRetryCount int + RetryCount int + ScheduledCheckAt *time.Time + SourceNzbPath *string + Status HealthStatus + StreamingFailureCount int + UpdatedAt time.Time + type HealthPriority int + const HealthPriorityHigh + const HealthPriorityNext + const HealthPriorityNormal + type HealthRepository struct + func NewHealthRepository(db *sql.DB, d Dialect) *HealthRepository + func (r *HealthRepository) AddFileToHealthCheck(ctx context.Context, filePath string, maxRetries int, maxRepairRetries int, ...) error + func (r *HealthRepository) AddFileToHealthCheckWithMetadata(ctx context.Context, filePath string, maxRetries int, maxRepairRetries int, ...) error + func (r *HealthRepository) AddHealthCheck(ctx context.Context, filePath string, releaseDate time.Time, ...) error + func (r *HealthRepository) BackfillReleaseDates(ctx context.Context, updates []BackfillUpdate) error + func (r *HealthRepository) BatchAddAutomaticHealthChecks(ctx context.Context, records []AutomaticHealthCheckRecord) error + func (r *HealthRepository) CleanupHealthRecords(ctx context.Context, existingFiles []string) error + func (r *HealthRepository) CountHealthItems(ctx context.Context, statusFilter *HealthStatus, sinceFilter *time.Time, ...) (int, error) + func (r *HealthRepository) DeleteHealthRecord(ctx context.Context, filePath string) error + func (r *HealthRepository) DeleteHealthRecordByID(ctx context.Context, id int64) error + func (r *HealthRepository) DeleteHealthRecordByLibraryPath(ctx context.Context, libraryPath string) (string, error) + func (r *HealthRepository) DeleteHealthRecordsBulk(ctx context.Context, filePaths []string) error + func (r *HealthRepository) DeleteHealthRecordsByDate(ctx context.Context, olderThan time.Time, statusFilter *HealthStatus) (int, error) + func (r *HealthRepository) DeleteHealthRecordsByLibraryPathPrefix(ctx context.Context, libraryPathPrefix string) ([]string, int64, error) + func (r *HealthRepository) DeleteHealthRecordsByPrefix(ctx context.Context, prefix string) (int64, error) + func (r *HealthRepository) GetAllHealthCheckPaths(ctx context.Context) ([]string, error) + func (r *HealthRepository) GetAllHealthCheckRecords(ctx context.Context) ([]AutomaticHealthCheckRecord, error) + func (r *HealthRepository) GetFileHealth(ctx context.Context, filePath string) (*FileHealth, error) + func (r *HealthRepository) GetFileHealthByID(ctx context.Context, id int64) (*FileHealth, error) + func (r *HealthRepository) GetFilesByPaths(ctx context.Context, filePaths []string) ([]*FileHealth, error) + func (r *HealthRepository) GetFilesForLibrarySync(ctx context.Context) ([]*FileHealth, error) + func (r *HealthRepository) GetFilesForRepairNotification(ctx context.Context, limit int) ([]*FileHealth, error) + func (r *HealthRepository) GetFilesMissingReleaseDate(ctx context.Context, limit int) ([]BackfillRecord, error) + func (r *HealthRepository) GetFilesWithoutLibraryPath(ctx context.Context) ([]*FileHealth, error) + func (r *HealthRepository) GetHealthStats(ctx context.Context) (map[HealthStatus]int, error) + func (r *HealthRepository) GetSystemState(ctx context.Context, key string) (string, error) + func (r *HealthRepository) GetUnhealthyFiles(ctx context.Context, limit int, strategy string, libraryDir string, ...) ([]*FileHealth, error) + func (r *HealthRepository) HasImportHistoryForPath(ctx context.Context, virtualPath string) (bool, error) + func (r *HealthRepository) IncrementRepairRetryCount(ctx context.Context, filePath string, errorMessage *string, ...) error + func (r *HealthRepository) IncrementRetryCount(ctx context.Context, filePath string, errorMessage *string, ...) error + func (r *HealthRepository) IncrementStreamingFailureCount(ctx context.Context, filePath string, threshold int) (bool, bool, error) + func (r *HealthRepository) ListHealthItems(ctx context.Context, statusFilter *HealthStatus, limit, offset int, ...) ([]*FileHealth, error) + func (r *HealthRepository) MarkAsCorrupted(ctx context.Context, filePath string, finalError *string, errorDetails *string) error + func (r *HealthRepository) MarkAsHealthy(ctx context.Context, filePath string, nextCheckTime time.Time) error + func (r *HealthRepository) RegisterCorruptedFile(ctx context.Context, filePath string, libraryPath *string, errorMessage string) error + func (r *HealthRepository) RelinkFileByFilename(ctx context.Context, filename, filePath, libraryPath string) error + func (r *HealthRepository) RenameHealthRecord(ctx context.Context, oldPath, newPath string) error + func (r *HealthRepository) ResetAllHealthChecks(ctx context.Context) (int, error) + func (r *HealthRepository) ResetFileAllChecking(ctx context.Context) error + func (r *HealthRepository) ResetHealthChecksBulk(ctx context.Context, filePaths []string) (int, error) + func (r *HealthRepository) ResetStalePendingFiles(ctx context.Context) error + func (r *HealthRepository) ResolvePendingRepairsInDirectory(ctx context.Context, dirPath string) (int64, error) + func (r *HealthRepository) SetCorrupted(ctx context.Context, filePath string, errorMessage *string, ...) error + func (r *HealthRepository) SetFileChecking(ctx context.Context, filePath string) error + func (r *HealthRepository) SetFileCheckingByID(ctx context.Context, id int64) error + func (r *HealthRepository) SetPriority(ctx context.Context, id int64, priority HealthPriority) error + func (r *HealthRepository) SetRepairTriggered(ctx context.Context, filePath string, errorMessage *string, ...) error + func (r *HealthRepository) SetRepairTriggeredByID(ctx context.Context, id int64, errorMessage *string, errorDetails *string) error + func (r *HealthRepository) UnmaskFile(ctx context.Context, filePath string) error + func (r *HealthRepository) UpdateFileHealth(ctx context.Context, filePath string, status HealthStatus, ...) error + func (r *HealthRepository) UpdateFileHealthScheduled(ctx context.Context, filePath string, status HealthStatus, ...) error + func (r *HealthRepository) UpdateHealthStatusBulk(ctx context.Context, updates []HealthStatusUpdate) error + func (r *HealthRepository) UpdateLibraryPath(ctx context.Context, filePath string, libraryPath string) error + func (r *HealthRepository) UpdateScheduledCheckTime(ctx context.Context, filePath string, nextCheckTime time.Time) error + func (r *HealthRepository) UpdateSystemState(ctx context.Context, key string, value string) error + type HealthStatus string + const HealthStatusChecking + const HealthStatusCorrupted + const HealthStatusHealthy + const HealthStatusPending + const HealthStatusRepairTriggered + type HealthStatusUpdate struct + ErrorDetails *string + ErrorMessage *string + FilePath string + ScheduledCheckAt time.Time + Skip bool + Status HealthStatus + Type UpdateType + type ImportDailyStat struct + BytesDownloaded int64 + CompletedCount int + Day time.Time + FailedCount int + UpdatedAt time.Time + type ImportHistory struct + Category *string + CompletedAt time.Time + FileName string + FileSize int64 + ID int64 + LibraryPath *string + Metadata *string + NzbID *int64 + NzbName string + VirtualPath string + type ImportHourlyStat struct + BytesDownloaded int64 + CompletedCount int + FailedCount int + Hour time.Time + UpdatedAt time.Time + type ImportQueueItem struct + BatchID *string + Category *string + CompletedAt *time.Time + CreatedAt time.Time + ErrorMessage *string + FileSize *int64 + ID int64 + MaxRetries int + Metadata *string + NzbPath string + Priority QueuePriority + RelativePath *string + RetryCount int + StartedAt *time.Time + Status QueueStatus + StoragePath *string + TargetPath *string + UpdatedAt time.Time + type QueuePriority int + const QueuePriorityHigh + const QueuePriorityLow + const QueuePriorityNormal + type QueueRepository struct + func NewQueueRepository(db *sql.DB, d Dialect) *QueueRepository + func (r *QueueRepository) AddBatchToQueue(ctx context.Context, items []*ImportQueueItem) error + func (r *QueueRepository) AddImportHistory(ctx context.Context, history *ImportHistory) error + func (r *QueueRepository) AddStoragePath(ctx context.Context, itemID int64, storagePath string) error + func (r *QueueRepository) AddToQueue(ctx context.Context, item *ImportQueueItem) error + func (r *QueueRepository) ClaimNextQueueItem(ctx context.Context) (*ImportQueueItem, error) + func (r *QueueRepository) ClearDailyStats(ctx context.Context) error + func (r *QueueRepository) ClearHourlyStats(ctx context.Context) error + func (r *QueueRepository) ClearImportHistory(ctx context.Context) error + func (r *QueueRepository) ClearImportHistorySince(ctx context.Context, since time.Time) error + func (r *QueueRepository) DeleteFailedItemsOlderThan(ctx context.Context, olderThan time.Time) ([]*ImportQueueItem, error) + func (r *QueueRepository) FilterExistingNzbdavIds(ctx context.Context, ids []string) ([]string, error) + func (r *QueueRepository) GetImportDailyStats(ctx context.Context, days int) ([]*ImportDailyStat, error) + func (r *QueueRepository) GetImportHistory(ctx context.Context, days int) ([]*ImportDailyStat, error) + func (r *QueueRepository) GetImportHourlyStats(ctx context.Context, hours int) ([]*ImportHourlyStat, error) + func (r *QueueRepository) GetQueueItem(ctx context.Context, id int64) (*ImportQueueItem, error) + func (r *QueueRepository) GetQueueStats(ctx context.Context) (*QueueStats, error) + func (r *QueueRepository) IncrementDailyStat(ctx context.Context, statType string) error + func (r *QueueRepository) IncrementHourlyStat(ctx context.Context, statType string) error + func (r *QueueRepository) IncrementRetryCountAndResetStatus(ctx context.Context, id int64, errorMessage *string) (bool, error) + func (r *QueueRepository) IsFileInQueue(ctx context.Context, filePath string) (bool, error) + func (r *QueueRepository) ListImportHistory(ctx context.Context, limit int) ([]*ImportHistory, error) + func (r *QueueRepository) RemoveFromQueue(ctx context.Context, id int64) error + func (r *QueueRepository) RemoveFromQueueBulk(ctx context.Context, ids []int64) (*BulkOperationResult, error) + func (r *QueueRepository) ResetStaleItems(ctx context.Context) error + func (r *QueueRepository) RestartQueueItemsBulk(ctx context.Context, ids []int64) error + func (r *QueueRepository) UpdateQueueItemNzbPath(ctx context.Context, id int64, nzbPath string) error + func (r *QueueRepository) UpdateQueueItemPriority(ctx context.Context, id int64, priority QueuePriority) error + func (r *QueueRepository) UpdateQueueItemStatus(ctx context.Context, id int64, status QueueStatus, errorMessage *string) error + type QueueStats struct + AvgProcessingTimeMs *int + ID int64 + LastUpdated time.Time + TotalCompleted int + TotalFailed int + TotalProcessing int + TotalQueued int + type QueueStatus string + const QueueStatusCompleted + const QueueStatusFailed + const QueueStatusFallback + const QueueStatusPaused + const QueueStatusPending + const QueueStatusProcessing + type Repository struct + func NewRepository(db *sql.DB, d Dialect) *Repository + func (r *Repository) AddBatchToQueue(ctx context.Context, items []*ImportQueueItem) error + func (r *Repository) AddBytesDownloadedToDailyStat(ctx context.Context, bytes int64) error + func (r *Repository) AddBytesDownloadedToHourlyStat(ctx context.Context, bytes int64) error + func (r *Repository) AddImportHistory(ctx context.Context, history *ImportHistory) error + func (r *Repository) AddToQueue(ctx context.Context, item *ImportQueueItem) error + func (r *Repository) BatchUpdateSystemStats(ctx context.Context, stats map[string]int64) error + func (r *Repository) ClaimNextQueueItem(ctx context.Context) (*ImportQueueItem, error) + func (r *Repository) ClearCompletedQueueItems(ctx context.Context) (int, error) + func (r *Repository) ClearDailyStats(ctx context.Context) error + func (r *Repository) ClearDailyStatsSince(ctx context.Context, since time.Time) error + func (r *Repository) ClearFailedQueueItems(ctx context.Context) (int, error) + func (r *Repository) ClearHourlyStats(ctx context.Context) error + func (r *Repository) ClearHourlyStatsSince(ctx context.Context, since time.Time) error + func (r *Repository) ClearImportHistory(ctx context.Context) error + func (r *Repository) ClearImportHistorySince(ctx context.Context, since time.Time) error + func (r *Repository) ClearPendingQueueItems(ctx context.Context) (int, error) + func (r *Repository) CountActiveQueueItems(ctx context.Context, search string, category string) (int, error) + func (r *Repository) CountQueueItems(ctx context.Context, status *QueueStatus, search string, category string) (int, error) + func (r *Repository) FilterExistingNzbdavIds(ctx context.Context, ids []string) ([]string, error) + func (r *Repository) GetExpiredStremioQueueItems(ctx context.Context, ttlHours int, tempUploadDir string) ([]*ImportQueueItem, error) + func (r *Repository) GetImportDailyStats(ctx context.Context, days int) ([]*ImportDailyStat, error) + func (r *Repository) GetImportHistory(ctx context.Context, days int) ([]*ImportDailyStat, error) + func (r *Repository) GetImportHistoryByPath(ctx context.Context, virtualPath string) (*ImportHistory, error) + func (r *Repository) GetImportHourlyStats(ctx context.Context, hours int) ([]*ImportHourlyStat, error) + func (r *Repository) GetQueueItem(ctx context.Context, id int64) (*ImportQueueItem, error) + func (r *Repository) GetQueueStats(ctx context.Context) (*QueueStats, error) + func (r *Repository) GetSystemState(ctx context.Context, key string) (string, error) + func (r *Repository) GetSystemStats(ctx context.Context) (map[string]int64, error) + func (r *Repository) IncrementDailyStat(ctx context.Context, statType string) error + func (r *Repository) IncrementHourlyStat(ctx context.Context, statType string) error + func (r *Repository) IsFileInQueue(ctx context.Context, filePath string) (bool, error) + func (r *Repository) ListActiveQueueItems(ctx context.Context, search string, category string, limit, offset int, ...) ([]*ImportQueueItem, error) + func (r *Repository) ListImportHistory(ctx context.Context, limit, offset int, search string, category string) ([]*ImportHistory, error) + func (r *Repository) ListQueueItems(ctx context.Context, status *QueueStatus, search string, category string, ...) ([]*ImportQueueItem, error) + func (r *Repository) ListRecentImportHistory(ctx context.Context, minutes int, category string) ([]*ImportHistory, error) + func (r *Repository) RemoveFromHistory(ctx context.Context, id int64) (int64, error) + func (r *Repository) RemoveFromHistoryByNzbID(ctx context.Context, nzbID int64) (int64, error) + func (r *Repository) RemoveFromQueue(ctx context.Context, id int64) error + func (r *Repository) RemoveFromQueueBulk(ctx context.Context, ids []int64) (*BulkOperationResult, error) + func (r *Repository) RestartQueueItemsBulk(ctx context.Context, ids []int64) error + func (r *Repository) UpdateQueueItemPriority(ctx context.Context, id int64, priority QueuePriority) error + func (r *Repository) UpdateQueueItemStatus(ctx context.Context, id int64, status QueueStatus, errorMessage *string) error + func (r *Repository) UpdateQueueStats(ctx context.Context) error + func (r *Repository) UpdateSystemStat(ctx context.Context, key string, value int64) error + func (r *Repository) UpdateSystemState(ctx context.Context, key string, value string) error + func (r *Repository) WithImmediateTransaction(ctx context.Context, fn func(*Repository) error) error + func (r *Repository) WithTransaction(ctx context.Context, fn func(*Repository) error) error + type SystemStat struct + Key string + UpdatedAt time.Time + Value int64 + type UpdateType int + const UpdateTypeCorrupted + const UpdateTypeHealthy + const UpdateTypeRepairRetry + const UpdateTypeRepairTrigger + const UpdateTypeRetry + type User struct + APIKey *string + AvatarURL *string + CreatedAt time.Time + Email *string + ID int64 + IsAdmin bool + LastLogin *time.Time + Name *string + PasswordHash *string + Provider string + ProviderID *string + UpdatedAt time.Time + UserID string + type UserRepository struct + func NewUserRepository(db *sql.DB, d Dialect) *UserRepository + func (r *UserRepository) CreateUser(ctx context.Context, user *User) error + func (r *UserRepository) GetAllUsers(ctx context.Context) ([]*User, error) + func (r *UserRepository) GetUserByAPIKey(ctx context.Context, apiKey string) (*User, error) + func (r *UserRepository) GetUserByEmail(ctx context.Context, email string) (*User, error) + func (r *UserRepository) GetUserByID(ctx context.Context, userID string) (*User, error) + func (r *UserRepository) GetUserByProvider(ctx context.Context, provider, providerID string) (*User, error) + func (r *UserRepository) GetUserByUsername(ctx context.Context, username string) (*User, error) + func (r *UserRepository) GetUserCount(ctx context.Context) (int, error) + func (r *UserRepository) RegenerateAPIKey(ctx context.Context, userID string) (string, error) + func (r *UserRepository) UpdateLastLogin(ctx context.Context, userID string) error + func (r *UserRepository) UpdatePassword(ctx context.Context, userID string, passwordHash string) error v0.0.1-alpha6 Feb 27, 2026 v0.0.1-alpha5 Nov 13, 2025 v0.0.1-alpha4 Oct 1, 2025 v0.0.1-alpha3 Sep 9, 2025 v0.0.1-alpha2 Sep 7, 2025 v0.0.1-alpha1 Sep 6, 2025 v0.0.1-alpha0 Sep 5, 2025