Implement artist GetByID
This commit is contained in:
@@ -3,10 +3,13 @@ package repository
|
||||
import (
|
||||
"context"
|
||||
db "zardzul/music-index/sqlc"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
type ArtistRepository interface {
|
||||
GetAll(ctx context.Context) ([]db.Artist, error)
|
||||
GetByID(ctx context.Context, id pgtype.UUID) (db.Artist, error)
|
||||
}
|
||||
|
||||
type SQLCArtistRepository struct {
|
||||
@@ -20,3 +23,7 @@ func NewArtistRepository(queries *db.Queries) *SQLCArtistRepository {
|
||||
func (r *SQLCArtistRepository) GetAll(ctx context.Context) ([]db.Artist, error) {
|
||||
return r.q.GetAllArtists(ctx)
|
||||
}
|
||||
|
||||
func (r *SQLCArtistRepository) GetByID(ctx context.Context, id pgtype.UUID) (db.Artist, error) {
|
||||
return r.q.GetArtistByID(ctx, id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user