db

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: GPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CookiePath

func CookiePath(dbPath, fileName string) (string, error)

func DefaultPath

func DefaultPath() (string, error)

func FileInSubdir

func FileInSubdir(dbPath, dirName, fileName string) (string, error)

func IsBusyError

func IsBusyError(err error) bool

func Migrate

func Migrate(db *sql.DB) error

func MigrateContext

func MigrateContext(ctx context.Context, db *sql.DB) error

func RootDir

func RootDir(dbPath string) (string, error)

func Subdir

func Subdir(dbPath, name string) (string, error)

Types

type DVDMediaInfo

type DVDMediaInfo = api.DVDMediaInfo

type DescriptionOverride

type DescriptionOverride = api.DescriptionOverride

type ExternalIDs

type ExternalIDs = api.ExternalIDs

type ExternalMetadata

type ExternalMetadata = api.ExternalMetadata

type FileMetadata

type FileMetadata = api.FileMetadata

type HistoryEntry

type HistoryEntry = api.HistoryEntry

type HistoryOverview

type HistoryOverview = api.HistoryOverview

type IMDBMetadata

type IMDBMetadata = api.IMDBMetadata

type Logger

type Logger interface {
	Debugf(format string, args ...any)
	Infof(format string, args ...any)
	Warnf(format string, args ...any)
}

type MetadataRepository

type MetadataRepository = api.MetadataRepository

type PlaylistInfo

type PlaylistInfo = api.PlaylistInfo

type PlaylistItem

type PlaylistItem = api.PlaylistItem

type PlaylistSelection

type PlaylistSelection = api.PlaylistSelection

type ReleaseNameOverrides

type ReleaseNameOverrides = api.ReleaseNameOverrides

type SQLiteRepository

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

func Open

func Open(path string) (*SQLiteRepository, error)

func OpenContext

func OpenContext(ctx context.Context, path string) (*SQLiteRepository, error)

func OpenWithLogger

func OpenWithLogger(path string, logger Logger) (*SQLiteRepository, error)

func OpenWithLoggerContext

func OpenWithLoggerContext(ctx context.Context, path string, logger Logger) (*SQLiteRepository, error)

func (*SQLiteRepository) Close

func (r *SQLiteRepository) Close() error

func (*SQLiteRepository) ConfigSectionLastUpdated

func (r *SQLiteRepository) ConfigSectionLastUpdated(ctx context.Context, section string) (time.Time, error)

ConfigSectionLastUpdated returns the last update time for a config section.

func (*SQLiteRepository) CreateUploadRecord

func (r *SQLiteRepository) CreateUploadRecord(ctx context.Context, record UploadRecord) error

func (*SQLiteRepository) DBPath added in v0.2.0

func (r *SQLiteRepository) DBPath() string

DBPath returns the resolved on-disk database path when the repository was opened from a normal filesystem path. It returns empty for SQLite sentinel or URI inputs so callers do not invent helper-file locations for in-memory DBs or opaque SQLite connection strings.

func (*SQLiteRepository) DeleteDescriptionOverride

func (r *SQLiteRepository) DeleteDescriptionOverride(ctx context.Context, path string, groupKey string) error

func (*SQLiteRepository) DeleteFinalSelection

func (r *SQLiteRepository) DeleteFinalSelection(ctx context.Context, imagePath string) error

func (*SQLiteRepository) DeletePlaylistSelection

func (r *SQLiteRepository) DeletePlaylistSelection(ctx context.Context, sourcePath string) error

func (*SQLiteRepository) DeleteReleaseNameOverrides

func (r *SQLiteRepository) DeleteReleaseNameOverrides(ctx context.Context, path string) error

func (*SQLiteRepository) DeleteScreenshot

func (r *SQLiteRepository) DeleteScreenshot(ctx context.Context, imagePath string) error

func (*SQLiteRepository) DeleteUploadedImage

func (r *SQLiteRepository) DeleteUploadedImage(ctx context.Context, path string, imagePath string, host string) error

func (*SQLiteRepository) GetByPath

func (r *SQLiteRepository) GetByPath(ctx context.Context, path string) (FileMetadata, error)

func (*SQLiteRepository) GetDVDMediaInfo

func (r *SQLiteRepository) GetDVDMediaInfo(ctx context.Context, path string) (DVDMediaInfo, error)

func (*SQLiteRepository) GetDescriptionOverride

func (r *SQLiteRepository) GetDescriptionOverride(ctx context.Context, path string, groupKey string) (DescriptionOverride, error)

func (*SQLiteRepository) GetExternalIDs

func (r *SQLiteRepository) GetExternalIDs(ctx context.Context, path string) (ExternalIDs, error)

func (*SQLiteRepository) GetExternalMetadata

func (r *SQLiteRepository) GetExternalMetadata(ctx context.Context, path string) (ExternalMetadata, error)

func (*SQLiteRepository) GetPlaylistSelection

func (r *SQLiteRepository) GetPlaylistSelection(ctx context.Context, sourcePath string) (PlaylistSelection, error)

func (*SQLiteRepository) GetReleaseNameOverrides

func (r *SQLiteRepository) GetReleaseNameOverrides(ctx context.Context, path string) (ReleaseNameOverrides, error)

func (*SQLiteRepository) GetTrackerTimestamp

func (r *SQLiteRepository) GetTrackerTimestamp(ctx context.Context, tracker string) (time.Time, error)

func (*SQLiteRepository) ListDescriptionOverridesByPath

func (r *SQLiteRepository) ListDescriptionOverridesByPath(ctx context.Context, path string) ([]DescriptionOverride, error)

func (*SQLiteRepository) ListFinalSelections

func (r *SQLiteRepository) ListFinalSelections(ctx context.Context, path string) ([]ScreenshotFinalSelection, error)

func (*SQLiteRepository) ListHistoryEntries

func (r *SQLiteRepository) ListHistoryEntries(ctx context.Context) ([]HistoryEntry, error)

func (*SQLiteRepository) ListPendingUploads

func (r *SQLiteRepository) ListPendingUploads(ctx context.Context) ([]UploadRecord, error)

func (*SQLiteRepository) ListScreenshotSlotsByPath

func (r *SQLiteRepository) ListScreenshotSlotsByPath(ctx context.Context, path string) ([]ScreenshotSlot, error)

func (*SQLiteRepository) ListScreenshotsByPath

func (r *SQLiteRepository) ListScreenshotsByPath(ctx context.Context, path string) ([]Screenshot, error)

func (*SQLiteRepository) ListStoredReleasePaths

func (r *SQLiteRepository) ListStoredReleasePaths(ctx context.Context) ([]string, error)

func (*SQLiteRepository) ListTrackerMetadataByPath

func (r *SQLiteRepository) ListTrackerMetadataByPath(ctx context.Context, path string) ([]TrackerMetadata, error)

func (*SQLiteRepository) ListTrackerRuleFailuresByPath

func (r *SQLiteRepository) ListTrackerRuleFailuresByPath(ctx context.Context, path string) ([]TrackerRuleFailure, error)

func (*SQLiteRepository) ListUploadHistoryByPath

func (r *SQLiteRepository) ListUploadHistoryByPath(ctx context.Context, sourcePath string) ([]UploadRecord, error)

func (*SQLiteRepository) ListUploadedImagesByPath

func (r *SQLiteRepository) ListUploadedImagesByPath(ctx context.Context, path string) ([]UploadedImageLink, error)

func (*SQLiteRepository) LoadConfigSection

func (r *SQLiteRepository) LoadConfigSection(ctx context.Context, section string, dest any) error

LoadConfigSection retrieves a single config section from the database.

func (*SQLiteRepository) LoadFullConfig

func (r *SQLiteRepository) LoadFullConfig(ctx context.Context, dest any) error

LoadFullConfig reconstructs the entire config from all sections. Each raw section is rejected if it contains duplicate JSON object names before the sections are joined, so malformed stored data cannot collapse duplicate keys during unmarshaling.

func (*SQLiteRepository) Migrate

func (r *SQLiteRepository) Migrate() error

func (*SQLiteRepository) MigrateContext

func (r *SQLiteRepository) MigrateContext(ctx context.Context) error

func (*SQLiteRepository) PurgeContentData

func (r *SQLiteRepository) PurgeContentData(ctx context.Context, path string) error

func (*SQLiteRepository) RawDB

func (r *SQLiteRepository) RawDB() *sql.DB

RawDB returns the underlying *sql.DB handle.

Callers using RawDB bypass repository safeguards such as validation, busy-retry behavior, and repository-level error wrapping. Restrict usage to approved low-level paths (for example migrations, tests, or advanced operations that are not exposed through repository methods), and avoid casual direct query/exec calls in application code.

func (*SQLiteRepository) ReplaceScreenshotSlots

func (r *SQLiteRepository) ReplaceScreenshotSlots(ctx context.Context, path string, slots []ScreenshotSlot) error

func (*SQLiteRepository) Save

func (r *SQLiteRepository) Save(ctx context.Context, metadata FileMetadata) error

func (*SQLiteRepository) SaveConfigSection

func (r *SQLiteRepository) SaveConfigSection(ctx context.Context, section string, data any) error

SaveConfigSection persists a single config section as JSON.

func (*SQLiteRepository) SaveConfigSections added in v0.2.0

func (r *SQLiteRepository) SaveConfigSections(ctx context.Context, sections map[string]any) error

SaveConfigSections persists multiple prepared config sections in one transaction. The map keys are config root section names and values are marshaled before the transaction starts; if any section write fails, no selected section is committed.

func (*SQLiteRepository) SaveDVDMediaInfo

func (r *SQLiteRepository) SaveDVDMediaInfo(ctx context.Context, info DVDMediaInfo) error

func (*SQLiteRepository) SaveDescriptionOverride

func (r *SQLiteRepository) SaveDescriptionOverride(ctx context.Context, override DescriptionOverride) error

func (*SQLiteRepository) SaveExternalIDs

func (r *SQLiteRepository) SaveExternalIDs(ctx context.Context, ids ExternalIDs) error

func (*SQLiteRepository) SaveExternalMetadata

func (r *SQLiteRepository) SaveExternalMetadata(ctx context.Context, metadata ExternalMetadata) error

func (*SQLiteRepository) SaveFinalSelections

func (r *SQLiteRepository) SaveFinalSelections(ctx context.Context, path string, selections []ScreenshotFinalSelection) error

func (*SQLiteRepository) SaveFullConfig

func (r *SQLiteRepository) SaveFullConfig(ctx context.Context, cfg any) error

SaveFullConfig persists the entire config to all sections. This is called when exporting to database from YAML or UI updates.

func (*SQLiteRepository) SaveFullConfigWithPreSave added in v0.2.0

func (r *SQLiteRepository) SaveFullConfigWithPreSave(ctx context.Context, cfg any, preSave func(context.Context, *sql.Tx) error) error

SaveFullConfigWithPreSave persists the entire config and runs preSave in the same write transaction immediately before config sections are written. If preSave or any section write fails, the transaction is rolled back.

func (*SQLiteRepository) SavePlaylistSelection

func (r *SQLiteRepository) SavePlaylistSelection(ctx context.Context, sourcePath string, playlists []string, useAll bool) error

func (*SQLiteRepository) SaveReleaseNameOverrides

func (r *SQLiteRepository) SaveReleaseNameOverrides(ctx context.Context, path string, overrides ReleaseNameOverrides) error

func (*SQLiteRepository) SaveScreenshot

func (r *SQLiteRepository) SaveScreenshot(ctx context.Context, screenshot Screenshot) error

func (*SQLiteRepository) SaveTrackerMetadata

func (r *SQLiteRepository) SaveTrackerMetadata(ctx context.Context, metadata TrackerMetadata) error

func (*SQLiteRepository) SaveTrackerRuleFailures

func (r *SQLiteRepository) SaveTrackerRuleFailures(ctx context.Context, sourcePath string, tracker string, failures []TrackerRuleFailure) error

func (*SQLiteRepository) SaveTrackerTimestamp

func (r *SQLiteRepository) SaveTrackerTimestamp(ctx context.Context, timestamp TrackerTimestamp) error

func (*SQLiteRepository) SaveUploadedImages

func (r *SQLiteRepository) SaveUploadedImages(ctx context.Context, path string, host string, images []UploadedImageLink) error

func (*SQLiteRepository) UpdateLatestUploadRecordStatus

func (r *SQLiteRepository) UpdateLatestUploadRecordStatus(ctx context.Context, sourcePath string, tracker string, status string) error

func (*SQLiteRepository) UpsertScreenshotSlotVariants

func (r *SQLiteRepository) UpsertScreenshotSlotVariants(ctx context.Context, path string, variants []ScreenshotSlotVariant) error

type Screenshot

type Screenshot = api.Screenshot

type ScreenshotFinalSelection

type ScreenshotFinalSelection = api.ScreenshotFinalSelection

type ScreenshotPurpose

type ScreenshotPurpose = api.ScreenshotPurpose

type ScreenshotSlot

type ScreenshotSlot = api.ScreenshotSlot

type ScreenshotSlotVariant

type ScreenshotSlotVariant = api.ScreenshotSlotVariant

type TMDBMetadata

type TMDBMetadata = api.TMDBMetadata

type TVDBMetadata

type TVDBMetadata = api.TVDBMetadata

type TVmazeMetadata

type TVmazeMetadata = api.TVmazeMetadata

type TrackerMetadata

type TrackerMetadata = api.TrackerMetadata

type TrackerRuleFailure

type TrackerRuleFailure = api.TrackerRuleFailure

type TrackerTimestamp

type TrackerTimestamp = api.TrackerTimestamp

type UploadRecord

type UploadRecord = api.UploadRecord
type UploadedImageLink = api.UploadedImageLink

Jump to

Keyboard shortcuts

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