Removed unused code

This commit is contained in:
Deluan 2016-03-23 12:00:13 -04:00
parent 0e1618a6ac
commit d57f51c7ac
5 changed files with 6 additions and 13 deletions

View File

@ -9,7 +9,6 @@ type ArtistRepository interface {
BaseRepository
Put(m *Artist) error
Get(id string) (*Artist, error)
GetByName(name string) (*Artist, error)
PurgeInactive(active Artists) ([]string, error)
}

View File

@ -3,7 +3,6 @@ package domain
import "errors"
type BaseRepository interface {
NewId(fields ...string) string
CountAll() (int64, error)
Exists(id string) (bool, error)
}

View File

@ -29,11 +29,6 @@ func (r *artistRepository) Get(id string) (*domain.Artist, error) {
return rec.(*domain.Artist), err
}
func (r *artistRepository) GetByName(name string) (*domain.Artist, error) {
id := r.NewId(name)
return r.Get(id)
}
func (r *artistRepository) PurgeInactive(active domain.Artists) ([]string, error) {
return r.purgeInactive(active, func(e interface{}) string {
return e.(domain.Artist).Id

View File

@ -54,7 +54,7 @@ func (r *ledisRepository) parseAnnotations(entity interface{}) {
}
// TODO Use annotations to specify fields to be used
func (r *ledisRepository) NewId(fields ...string) string {
func (r *ledisRepository) newId(fields ...string) string {
s := fmt.Sprintf("%s\\%s", strings.ToUpper(r.table), strings.Join(fields, ""))
return fmt.Sprintf("%x", md5.Sum([]byte(s)))
}

View File

@ -90,15 +90,15 @@ func TestBaseRepository(t *testing.T) {
repo := createEmptyRepo()
Convey("When I call NewId with a name", func() {
Id := repo.NewId("a name")
Id := repo.newId("a name")
Convey("Then it should return a new Id", func() {
So(Id, ShouldNotBeEmpty)
})
})
Convey("When I call NewId with the same name twice", func() {
FirstId := repo.NewId("a name")
SecondId := repo.NewId("a name")
FirstId := repo.newId("a name")
SecondId := repo.newId("a name")
Convey("Then it should return the same Id each time", func() {
So(FirstId, ShouldEqual, SecondId)
@ -107,8 +107,8 @@ func TestBaseRepository(t *testing.T) {
})
Convey("When I call NewId with different names", func() {
FirstId := repo.NewId("first name")
SecondId := repo.NewId("second name")
FirstId := repo.newId("first name")
SecondId := repo.newId("second name")
Convey("Then it should return different Ids", func() {
So(FirstId, ShouldNotEqual, SecondId)