Big Importer/Scanner refactor

This commit is contained in:
Deluan
2016-03-04 16:42:09 -05:00
parent 7225807bad
commit 766fdbc60c
8 changed files with 205 additions and 152 deletions
+3 -2
View File
@@ -1,6 +1,7 @@
package persistence
import (
"errors"
"github.com/deluan/gosonic/domain"
)
@@ -16,7 +17,7 @@ func NewArtistRepository() domain.ArtistRepository {
func (r *artistRepository) Put(m *domain.Artist) error {
if m.Id == "" {
m.Id = r.NewId(m.Name)
return errors.New("Artist Id is not set")
}
return r.saveOrUpdate(m.Id, m)
}
@@ -32,4 +33,4 @@ func (r *artistRepository) GetByName(name string) (*domain.Artist, error) {
return r.Get(id)
}
var _ domain.ArtistRepository = (*artistRepository)(nil)
var _ domain.ArtistRepository = (*artistRepository)(nil)