gallerylib

package
v0.1.149 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gallerylib provides the business logic for importing and managing gallery content in the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Importer

type Importer struct {
	Conn *sql.Conn
	Q    *gallerydb.CustomQueries
}

Importer provides methods for adding gallery content to the database.

func (*Importer) CreateRootFolderEntry

func (imp *Importer) CreateRootFolderEntry(ctx context.Context, mtime int64) (int64, error)

CreateRootFolderEntry creates or retrieves the root folder record in the database. It is idempotent and safe for concurrent calls. mtime is the filesystem modification time of the root directory (unix seconds). It returns the ID of the root folder.

func (*Importer) UpdateFolderTileChain

func (imp *Importer) UpdateFolderTileChain(ctx context.Context, folderID, tileFileID int64) error

UpdateFolderTileChain updates the tile_id for a given folder and recursively ascends the folder hierarchy. It sets the `tile_id` for each parent folder to the provided `tileFileID` until it reaches a folder that already has a tile or it reaches the root of the gallery. The `tileFileID` parameter must be an ID from the `files` table.

func (*Importer) UpsertPathChain

func (imp *Importer) UpsertPathChain(ctx context.Context, path string, mtime, size int64, md5 string, phash, width, height int64, mimeType string) (gallerydb.File, error)

UpsertPathChain ensures that all intermediate folders and the file record exist. It returns the final file record.

Jump to

Keyboard shortcuts

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