Versions in this module Expand all Collapse all v0 v0.4.0 Nov 3, 2026 Changes in this version + const ContentVerificationFailed + const ContentVerificationPassed + const ContentVerificationUnavailable + const IndexerUnknown + 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 + Metadata *string + type BackfillUpdate struct + ID int64 + ReleaseDate time.Time + ScheduledCheckAt time.Time + type BulkOperationResult struct + DeletedCount int + DeletedPaths []string + FailedIDs []int64 + ProcessingCount int + type Config struct + DSN string + DatabasePath string + Type string + type DB struct + MigrationRepo *ImportMigrationRepository + Repository *QueueRepository + StoreRefRepo *StoreRefRepository + 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) HasRSSImport(ctx context.Context, id string) (bool, error) + func (db *DB) RecordRSSImport(ctx context.Context, id string) error + func (db *DB) RemoveIncompleteRSSImport(ctx context.Context, id string) (bool, error) + func (db *DB) StartCheckpointLoop(ctx context.Context, interval time.Duration) + 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 DBSymlinkLookup struct + func NewDBSymlinkLookup(repo *ImportMigrationRepository) *DBSymlinkLookup + func (l *DBSymlinkLookup) LookupFinalPath(ctx context.Context, source, externalID string) (string, bool, error) + func (l *DBSymlinkLookup) MarkSymlinksMigrated(ctx context.Context, ids []int64) error + type Dialect string + const DialectPostgres + const DialectSQLite + type DuplicateCandidate struct + Hash string + Identity string + Name string + Path string + Size int64 + type FileHealth struct + CreatedAt time.Time + DownloadID *string + ErrorDetails *string + FilePath string + ID int64 + Indexer *string + IsMasked bool + LastChecked *time.Time + LastError *string + LibraryPath *string + MaxRepairRetries int + MaxRetries int + Metadata *string + Priority HealthPriority + ReleaseDate *time.Time + RepairRetryCount int + RetryCount int + ScheduledCheckAt *time.Time + SourceNzbPath *string + Status HealthStatus + StreamingFailureCount int + UpdatedAt time.Time + func (f *FileHealth) EffectiveLibraryPath() (string, bool) + func (f *FileHealth) IsImported() bool + type HealthCheckUpsert struct + DownloadID *string + FilePath string + Indexer *string + LibraryPath *string + MaxRepairRetries int + MaxRetries int + Metadata *string + Priority HealthPriority + ReleaseDate *time.Time + SourceNzbPath *string + type HealthErrorDetails struct + ContentVerification string + ErrorType string + Message string + MissingArticles int + PlaybackImpact *holes.Impact + Sampled int + TerminatedEarly bool + TerminationReason string + TotalArticles int + UnresolvedSegments int + func (d *HealthErrorDetails) Marshal() *string + 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, libraryPath *string, maxRetries int, ...) error + func (r *HealthRepository) AddFileToHealthCheckWithMetadata(ctx context.Context, filePath string, libraryPath *string, maxRetries 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) BatchAddFileToHealthCheck(ctx context.Context, records []HealthCheckUpsert) error + func (r *HealthRepository) CountHealthItems(ctx context.Context, statusFilter *HealthStatus, sinceFilter *time.Time, ...) (int, error) + func (r *HealthRepository) DeleteDuplicateCandidate(ctx context.Context, path string) 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) (int64, 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) DeleteUnvalidatedHealthRecordsByPrefix(ctx context.Context, prefix string) (int64, error) + func (r *HealthRepository) DuplicateCandidates(ctx context.Context, name string, size int64) ([]DuplicateCandidate, error) + func (r *HealthRepository) FindHealthyFilesForMovie(ctx context.Context, title string, year string, tmdbID int) ([]*FileHealth, error) + func (r *HealthRepository) FindHealthyFilesForSeries(ctx context.Context, seriesTitle string, tvdbID int) ([]*FileHealth, 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) GetFileHealthByLibraryPath(ctx context.Context, libraryPath string) (*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) 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) 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) LogIndexerImport(ctx context.Context, indexer string, status string, errMsg string, ...) error + func (r *HealthRepository) MarkAsHealthy(ctx context.Context, filePath string, nextCheckTime time.Time) error + func (r *HealthRepository) RecordPar2RepairFailure(ctx context.Context, filePath, reason string) 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, ...) (bool, error) + func (r *HealthRepository) RelinkFileByMetadata(ctx context.Context, webMeta *model.WebhookMetadata, ...) (bool, 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) SetDuplicateFingerprint(ctx context.Context, path, identity, hash 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) SetFilesCheckingBulk(ctx context.Context, filePaths []string) 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) UpdateFileMetadata(ctx context.Context, id int64, metadata []byte) 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 + func (r *HealthRepository) UpsertDuplicateCandidate(ctx context.Context, c DuplicateCandidate) error + type HealthStatus string + const HealthStatusChecking + const HealthStatusCorrupted + const HealthStatusDegraded + const HealthStatusHealthy + const HealthStatusPending + const HealthStatusRepairTriggered + type HealthStatusUpdate struct + ErrorDetails *string + ErrorMessage *string + ExpectedStatus *HealthStatus + 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 + DownloadID *string + FileName string + FileSize int64 + ID int64 + Indexer *string + 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 ImportMigration struct + CreatedAt time.Time + Error *string + ExternalID string + FinalPath *string + ID int64 + QueueItemID *int64 + RelativePath string + Source string + Status ImportMigrationStatus + UpdatedAt time.Time + type ImportMigrationRepository struct + func NewImportMigrationRepository(db *sql.DB, d Dialect) *ImportMigrationRepository + func (r *ImportMigrationRepository) BackfillFromImportQueue(ctx context.Context) (int, error) + func (r *ImportMigrationRepository) DeleteAllBySource(ctx context.Context, source string) (int64, error) + func (r *ImportMigrationRepository) DeletePendingBySource(ctx context.Context, source string) (int64, error) + func (r *ImportMigrationRepository) ExistsForSource(ctx context.Context, source string) (bool, error) + func (r *ImportMigrationRepository) LinkQueueItemID(ctx context.Context, source string, externalIDs []string, queueItemID int64) error + func (r *ImportMigrationRepository) ListByStatus(ctx context.Context, source string, status ImportMigrationStatus, ...) ([]*ImportMigration, error) + func (r *ImportMigrationRepository) LookupByExternalID(ctx context.Context, source, externalID string) (*ImportMigration, error) + func (r *ImportMigrationRepository) MarkFailed(ctx context.Context, queueItemID int64, errMsg string) error + func (r *ImportMigrationRepository) MarkImported(ctx context.Context, queueItemID int64, finalPath string) error + func (r *ImportMigrationRepository) MarkSymlinksMigrated(ctx context.Context, ids []int64) error + func (r *ImportMigrationRepository) Stats(ctx context.Context, source string) (*ImportMigrationStats, error) + func (r *ImportMigrationRepository) Upsert(ctx context.Context, row *ImportMigration) (int64, error) + type ImportMigrationStats struct + Failed int + Imported int + Pending int + SymlinksMigrated int + Total int + type ImportMigrationStatus string + const ImportMigrationStatusFailed + const ImportMigrationStatusImported + const ImportMigrationStatusPending + const ImportMigrationStatusSymlinksMigrated + type ImportQueueItem struct + BatchID *string + Category *string + CompletedAt *time.Time + CreatedAt time.Time + DownloadID *string + ErrorMessage *string + FileSize *int64 + ID int64 + Indexer *string + MaxRetries int + Metadata *string + NzbPath string + Priority QueuePriority + RelativePath *string + RetryCount int + SkipArrNotification bool + SkipPostImportLinks bool + StartedAt *time.Time + Status QueueStatus + StoragePath *string + TargetPath *string + UpdatedAt time.Time + type IndexerAggregatedHealth struct + FailedCount int + Indexer string + Last24hCount int + LastSeenAt time.Time + SuccessCount int + SuccessRate float64 + TotalImports int + type Par2RepairJob struct + Attempts int + CreatedAt time.Time + DeadSegmentIDs sql.NullString + FailingSegmentID sql.NullString + FilePath string + FinishedAt sql.NullTime + ID int64 + LastError sql.NullString + MemberPaths sql.NullString + NextAttemptAt sql.NullTime + NzbPath sql.NullString + ReleaseRef sql.NullString + StartedAt sql.NullTime + Status Par2RepairStatus + UpdatedAt time.Time + func (j *Par2RepairJob) DeadSegments() []string + func (j *Par2RepairJob) Members() []string + func (j *Par2RepairJob) RunDuration(now time.Time) (time.Duration, bool) + type Par2RepairRepository struct + func NewPar2RepairRepository(db *sql.DB, d Dialect) *Par2RepairRepository + func (r *Par2RepairRepository) AppendDeadSegment(ctx context.Context, id int64, messageID string) error + func (r *Par2RepairRepository) ClaimNext(ctx context.Context, now time.Time) (*Par2RepairJob, error) + func (r *Par2RepairRepository) Delete(ctx context.Context, id int64) error + func (r *Par2RepairRepository) DeleteFinished(ctx context.Context) error + func (r *Par2RepairRepository) Enqueue(ctx context.Context, filePath, releaseRef, failingSegmentID string) (created, attached bool, err error) + func (r *Par2RepairRepository) EnqueueNzb(ctx context.Context, nzbPath string, failingSegmentID string) (bool, error) + func (r *Par2RepairRepository) Get(ctx context.Context, id int64) (*Par2RepairJob, error) + func (r *Par2RepairRepository) List(ctx context.Context, limit int) ([]*Par2RepairJob, error) + func (r *Par2RepairRepository) MarkRetry(ctx context.Context, id int64, reason string, nextAttempt time.Time) error + func (r *Par2RepairRepository) ResetRunning(ctx context.Context) error + type Par2RepairStatus string + const Par2RepairStatusPending + const Par2RepairStatusRunning + type ProviderHistoricalStat struct + BytesDownloaded int64 + ProviderID string + Timestamp time.Time + type ProviderSpeedTestStat struct + CreatedAt time.Time + ID int64 + ProviderID string + SpeedMbps float64 + 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) ClearProviderHourlyStats(ctx context.Context) error + func (r *QueueRepository) DeleteFailedItemsOlderThan(ctx context.Context, olderThan time.Time) ([]*ImportQueueItem, error) + func (r *QueueRepository) DeleteImportHistoryByNzbID(ctx context.Context, nzbID int64) error + func (r *QueueRepository) DeleteImportHistoryOlderThan(ctx context.Context, olderThan time.Time) error + func (r *QueueRepository) DeleteIndexerStats(ctx context.Context, indexer string) (int64, error) + func (r *QueueRepository) ExpandNzbWrapper(ctx context.Context, parent *ImportQueueItem, children []*ImportQueueItem) 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) GetIndexerHealthStats(ctx context.Context) ([]*IndexerAggregatedHealth, error) + func (r *QueueRepository) GetPendingQueueItemsByPathPrefix(ctx context.Context, prefix string) ([]*ImportQueueItem, error) + func (r *QueueRepository) GetQueueItem(ctx context.Context, id int64) (*ImportQueueItem, error) + func (r *QueueRepository) GetQueueItemByDownloadID(ctx context.Context, downloadID string) (*ImportQueueItem, error) + func (r *QueueRepository) GetQueueItemByNzbPath(ctx context.Context, nzbPath string) (*ImportQueueItem, error) + func (r *QueueRepository) GetQueueStats(ctx context.Context) (*QueueStats, error) + func (r *QueueRepository) GetUnknownIndexerStatsDownloadIDs(ctx context.Context) ([]string, 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) LogIndexerImport(ctx context.Context, indexer string, status string, errMsg string, ...) error + func (r *QueueRepository) PruneIndexerStats(ctx context.Context, hours int) (int64, 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) UpdateImportHistoryIndexerByDownloadID(ctx context.Context, downloadID string, indexer string) error + func (r *QueueRepository) UpdateIndexerStatsByDownloadID(ctx context.Context, downloadID string, indexer string) error + func (r *QueueRepository) UpdateQueueItemCategory(ctx context.Context, id int64, category *string, priority QueuePriority) error + func (r *QueueRepository) UpdateQueueItemIndexer(ctx context.Context, id int64, indexer string) error + func (r *QueueRepository) UpdateQueueItemIndexerByDownloadID(ctx context.Context, downloadID string, indexer string) 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 + TotalWaitingRepair int + type QueueStatus string + const QueueStatusCompleted + const QueueStatusFailed + const QueueStatusFallback + const QueueStatusPaused + const QueueStatusPending + const QueueStatusProcessing + const QueueStatusWaitingRepair + 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) AddProviderBytesToHourlyStat(ctx context.Context, providerID string, bytes int64) 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) ([]string, 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) ([]string, 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) ([]string, int, error) + func (r *Repository) ClearProviderHourlyStats(ctx context.Context) 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) CountSABnzbdHistory(ctx context.Context, category string) (int, error) + func (r *Repository) DeleteIndexerStats(ctx context.Context, indexer string) (int64, error) + func (r *Repository) DeleteQueueItemsByPath(ctx context.Context, path string) error + func (r *Repository) GetCachedStremioQueueItems(ctx context.Context, reuseLibrary bool, ttlHours int) ([]*ImportQueueItem, error) + func (r *Repository) GetExpiredStremioQueueItems(ctx context.Context, ttlHours int) ([]*ImportQueueItem, error) + func (r *Repository) GetFailedStremioQueueItems(ctx context.Context) ([]*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) GetImportHistoryByDownloadID(ctx context.Context, downloadID string) (*ImportHistory, error) + func (r *Repository) GetImportHistoryByNzbID(ctx context.Context, nzbID int64) (*ImportHistory, error) + func (r *Repository) GetImportHistoryByPath(ctx context.Context, virtualPath string) (*ImportHistory, error) + func (r *Repository) GetImportHistoryItem(ctx context.Context, id int64) (*ImportHistory, error) + func (r *Repository) GetImportHourlyStats(ctx context.Context, hours int) ([]*ImportHourlyStat, error) + func (r *Repository) GetIndexerHealthStats(ctx context.Context) ([]*IndexerAggregatedHealth, error) + func (r *Repository) GetOldestProviderStatDates(ctx context.Context) (map[string]time.Time, error) + func (r *Repository) GetOldestStatDate(ctx context.Context) (time.Time, error) + func (r *Repository) GetProviderHistoricalStats(ctx context.Context, days int, interval string) ([]*ProviderHistoricalStat, error) + func (r *Repository) GetProviderHourlyStats(ctx context.Context, hours int) (map[string]int64, error) + func (r *Repository) GetProviderSpeedTestHistory(ctx context.Context, days int) ([]*ProviderSpeedTestStat, error) + func (r *Repository) GetQueueItem(ctx context.Context, id int64) (*ImportQueueItem, error) + func (r *Repository) GetQueueItemByDownloadID(ctx context.Context, downloadID string) (*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) GetUnknownIndexerStatsDownloadIDs(ctx context.Context) ([]string, error) + func (r *Repository) HasActiveOrRecentQueueItemForStoragePath(ctx context.Context, relPath string, completedGrace time.Duration) (bool, 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) ListSABnzbdFailedHistory(ctx context.Context, category string, max int) ([]*SABnzbdHistoryRow, error) + func (r *Repository) ListSABnzbdHistory(ctx context.Context, category string, limit, offset int) ([]*SABnzbdHistoryRow, error) + func (r *Repository) LogIndexerImport(ctx context.Context, indexer string, status string, errMsg string, ...) error + func (r *Repository) MigrateSystemStats(ctx context.Context, stats map[string]int64, deleteKeys []string) error + func (r *Repository) PruneIndexerStats(ctx context.Context, hours int) (int64, error) + func (r *Repository) RecordProviderSpeedTest(ctx context.Context, providerID string, speedMbps float64) error + func (r *Repository) RemoveFromHistory(ctx context.Context, id int64) (int64, error) + func (r *Repository) RemoveFromHistoryByDownloadID(ctx context.Context, downloadID string) (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) RemoveFromQueueByDownloadID(ctx context.Context, downloadID string) error + func (r *Repository) RestartQueueItemsBulk(ctx context.Context, ids []int64) error + func (r *Repository) UpdateImportHistoryIndexerByDownloadID(ctx context.Context, downloadID string, indexer string) error + func (r *Repository) UpdateIndexerStatsByDownloadID(ctx context.Context, downloadID string, indexer string) error + func (r *Repository) UpdateQueueItemIndexer(ctx context.Context, id int64, indexer string) error + func (r *Repository) UpdateQueueItemIndexerByDownloadID(ctx context.Context, downloadID string, indexer string) 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) UpdateQueueItemsPriorityBulk(ctx context.Context, ids []int64, priority QueuePriority) (updated int, skipped int, err 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 SABnzbdHistoryRow struct + Category *string + CompletedAt *time.Time + DownloadID *string + ErrorMessage *string + FileSize *int64 + ID int64 + Metadata *string + Name string + Source string + Status QueueStatus + StoragePath *string + type StoreRefRepository struct + func NewStoreRefRepository(db *sql.DB, d Dialect) *StoreRefRepository + func (r *StoreRefRepository) DecStoreRef(ctx context.Context, storePath string) (int64, bool, error) + func (r *StoreRefRepository) GetStoreRefCount(ctx context.Context, storePath string) (int64, error) + func (r *StoreRefRepository) IncStoreRef(ctx context.Context, storePath string) error + type UpdateType int + const UpdateTypeCorrupted + const UpdateTypeDegraded + const UpdateTypeHealthy + const UpdateTypeInconclusive + 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