interfaces

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: 3 Imported by: 0

README

interfaces package

Purpose: host shared contracts consumed by both the server orchestrator (internal/server) and the handlers package (internal/server/handlers) without creating import cycles. Interfaces in this package should represent cross-cutting dependencies that are injected into handlers.

Current contents:

  • HandlerQueries: read-only gallery queries used by handlers and wired from App via gallerydb generated queries.

Guidelines:

  • Add an interface here only if it is consumed by both server and handlers (or other subpackages) and would otherwise create a dependency loop.
  • Keep handler-only or server-only interfaces close to their packages; avoid growing this directory into a dumping ground.
  • Prefer small, focused interfaces that map to handler needs (e.g., read-only query sets) and can be satisfied by generated query types or mocks.

Future candidates:

  • If HandlerQueries expands with EXIF/IPTC reads, consider either extending the interface here or adding a sibling MetadataQueries when multiple packages need it.
  • Login-related persistence (if shared across packages) could be added here; otherwise keep it local to handlers.

Documentation

Overview

Package interfaces holds shared contracts consumed by both the server orchestrator (App) and the handlers package. These interfaces live here to avoid circular dependencies while keeping the contracts in a neutral, stable location.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HandlerQueries

type HandlerQueries interface {
	GetFolderViewByID(ctx context.Context, id int64) (gallerydb.FolderView, error)
	GetFoldersViewsByParentIDOrderByName(ctx context.Context, parent sql.NullInt64) ([]gallerydb.FolderView, error)
	GetFileViewsByFolderIDOrderByFileName(ctx context.Context, folderID sql.NullInt64) ([]gallerydb.FileView, error)
	GetFileViewByID(ctx context.Context, id int64) (gallerydb.FileView, error)
	GetFolderByID(ctx context.Context, id int64) (gallerydb.Folder, error)
	GetThumbnailsByFileID(ctx context.Context, fileID int64) (gallerydb.Thumbnail, error)
	GetThumbnailBlobDataByID(ctx context.Context, id int64) ([]byte, error)
	// GetPreloadRoutesByFolderID returns routes to preload for a folder (source of truth: direct children only).
	// Returns *sql.Rows; each row contains a route string to scan.
	GetPreloadRoutesByFolderID(ctx context.Context, parentID sql.NullInt64) (*sql.Rows, error)
	// GetGalleryStatistics returns aggregate statistics about the gallery (folder count, file count, total size, timestamps).
	GetGalleryStatistics(ctx context.Context) (gallerydb.GetGalleryStatisticsRow, error)
}

HandlerQueries abstracts the subset of DB queries used by HTTP handlers. Shared by server and handlers packages.

Jump to

Keyboard shortcuts

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