2756cc1043
- Add pg_trgm fuzzy search to PostgreSQL artist repository - Add Lucene fuzzy query (~0.7) for MusicBrainz artist search - Run DB and MusicBrainz searches in parallel goroutines - Cache MusicBrainz results to DB for accumulation - Deduplicate results by external ID - Filter out special purpose artists (type=Other) - Add SaveAll method for batch artist inserts - Move database schema to containers repo
83 lines
2.4 KiB
Go
83 lines
2.4 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/metadata-agregator/internal/domain"
|
|
"github.com/metadata-agregator/internal/repository"
|
|
)
|
|
|
|
type noopArtistRepo struct{}
|
|
|
|
func (r *noopArtistRepo) GetByID(ctx context.Context, id string) (*domain.Artist, error) {
|
|
return nil, repository.ErrNotFound
|
|
}
|
|
|
|
func (r *noopArtistRepo) GetByExternalID(ctx context.Context, source, sourceID string) (*domain.Artist, error) {
|
|
return nil, repository.ErrNotFound
|
|
}
|
|
|
|
func (r *noopArtistRepo) Search(ctx context.Context, query string, limit, offset int) (*domain.SearchResult[domain.Artist], error) {
|
|
return &domain.SearchResult[domain.Artist]{}, nil
|
|
}
|
|
|
|
func (r *noopArtistRepo) Save(ctx context.Context, artist *domain.Artist) error {
|
|
return nil
|
|
}
|
|
|
|
func (r *noopArtistRepo) SaveAll(ctx context.Context, artists []domain.Artist) error {
|
|
return nil
|
|
}
|
|
|
|
type noopAlbumRepo struct{}
|
|
|
|
func (r *noopAlbumRepo) GetByID(ctx context.Context, id string) (*domain.Album, error) {
|
|
return nil, repository.ErrNotFound
|
|
}
|
|
|
|
func (r *noopAlbumRepo) GetByExternalID(ctx context.Context, source, sourceID string) (*domain.Album, error) {
|
|
return nil, repository.ErrNotFound
|
|
}
|
|
|
|
func (r *noopAlbumRepo) GetByArtistID(ctx context.Context, artistID string, limit, offset int) (*domain.SearchResult[domain.Album], error) {
|
|
return &domain.SearchResult[domain.Album]{}, nil
|
|
}
|
|
|
|
func (r *noopAlbumRepo) GetAllByArtistID(ctx context.Context, artistID string) ([]domain.Album, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (r *noopAlbumRepo) Save(ctx context.Context, album *domain.Album) error {
|
|
return nil
|
|
}
|
|
|
|
func (r *noopAlbumRepo) SaveAll(ctx context.Context, albums []domain.Album) error {
|
|
return nil
|
|
}
|
|
|
|
type noopTrackRepo struct{}
|
|
|
|
func (r *noopTrackRepo) GetByID(ctx context.Context, id string) (*domain.Track, error) {
|
|
return nil, repository.ErrNotFound
|
|
}
|
|
|
|
func (r *noopTrackRepo) GetByExternalID(ctx context.Context, source, sourceID string) (*domain.Track, error) {
|
|
return nil, repository.ErrNotFound
|
|
}
|
|
|
|
func (r *noopTrackRepo) GetByISRC(ctx context.Context, isrc string) (*domain.Track, error) {
|
|
return nil, repository.ErrNotFound
|
|
}
|
|
|
|
func (r *noopTrackRepo) GetByAlbumID(ctx context.Context, albumID string) ([]domain.Track, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (r *noopTrackRepo) Save(ctx context.Context, track *domain.Track) error {
|
|
return nil
|
|
}
|
|
|
|
func (r *noopTrackRepo) SaveAlbumTracks(ctx context.Context, albumID string, tracks []domain.Track) error {
|
|
return nil
|
|
}
|