mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-18 21:07:44 +03:00
Removed unused code
This commit is contained in:
parent
0e1618a6ac
commit
d57f51c7ac
@ -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)
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@ package domain
|
||||
import "errors"
|
||||
|
||||
type BaseRepository interface {
|
||||
NewId(fields ...string) string
|
||||
CountAll() (int64, error)
|
||||
Exists(id string) (bool, error)
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)))
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user