Documentation
¶
Index ¶
- type DB
- func (db *DB) CleanupMissingFiles() ([]string, error)
- func (db *DB) Close() error
- func (db *DB) CountImages() (int, error)
- func (db *DB) DeleteImage(id int) (string, error)
- func (db *DB) DeleteImageBySourceID(source, sourceID string) (string, error)
- func (db *DB) DeleteOldImages(keepCount int) ([]string, error)
- func (db *DB) ExistsByChecksum(checksum string) (bool, error)
- func (db *DB) ExistsBySourceID(source, sourceID string) (bool, error)
- func (db *DB) FindDuplicates() ([][]Image, error)
- func (db *DB) GetImageByID(id int) (*Image, error)
- func (db *DB) InsertImage(img *Image) error
- func (db *DB) ListImages(source string, limit int) ([]Image, error)
- type Image
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB represents the database connection
func (*DB) CleanupMissingFiles ¶
CleanupMissingFiles removes database entries for files that no longer exist on disk
func (*DB) CountImages ¶
CountImages returns the total number of images
func (*DB) DeleteImage ¶
DeleteImage deletes an image by ID and returns the local path
func (*DB) DeleteImageBySourceID ¶
DeleteImageBySourceID deletes an image by source and source_id
func (*DB) DeleteOldImages ¶
DeleteOldImages deletes old images keeping only the most recent ones
func (*DB) ExistsByChecksum ¶
ExistsByChecksum checks if an image exists by checksum
func (*DB) ExistsBySourceID ¶
ExistsBySourceID checks if an image exists by source and source ID
func (*DB) FindDuplicates ¶
FindDuplicates finds duplicate images by checksum
func (*DB) GetImageByID ¶
GetImageByID gets an image by ID
func (*DB) InsertImage ¶
InsertImage inserts a new image record
type Image ¶
type Image struct { ID int `json:"id"` Source string `json:"source"` SourceID string `json:"source_id"` URL string `json:"url"` LocalPath string `json:"local_path"` Checksum string `json:"checksum"` Tags string `json:"tags"` Resolution string `json:"resolution"` FileSize int64 `json:"file_size"` DownloadedAt time.Time `json:"downloaded_at"` }
Image represents an image record in the database