fix: address code review findings

This commit is contained in:
2026-07-19 19:07:20 +03:00
parent a4c426f640
commit c70f46af27
10 changed files with 77 additions and 124 deletions

View File

@@ -119,28 +119,6 @@ func SetReleaseIgnored(db *DB, rgid string, ignored bool) error {
return nil
}
// DeleteExternalReleasesByArtist removes all external_release rows for a given artist_id.
func DeleteExternalReleasesByArtist(db *DB, artistID string) error {
_, err := db.Conn().Exec(
"DELETE FROM external_releases WHERE artist_id = ?",
artistID,
)
if err != nil {
return fmt.Errorf("delete external releases by artist: %w", err)
}
return nil
}
// CountExternalReleases returns the total number of external_release rows.
func CountExternalReleases(db *DB) (int, error) {
var count int
err := db.Conn().QueryRow("SELECT COUNT(*) FROM external_releases").Scan(&count)
if err != nil {
return 0, fmt.Errorf("count external releases: %w", err)
}
return count, nil
}
// GetExternalReleasesByArtistWithCache returns cached external_release rows for a given artist_id
// that are within the specified TTL.
func GetExternalReleasesByArtistWithCache(db *DB, artistID string, ttl time.Duration) ([]ExternalRelease, error) {