Indexes using slices instead of pointers of slice
This commit is contained in:
@@ -31,10 +31,10 @@ func (r *artistIndexRepository) Get(id string) (*domain.ArtistIndex, error) {
|
||||
return rec.(*domain.ArtistIndex), err
|
||||
}
|
||||
|
||||
func (r *artistIndexRepository) GetAll() (*domain.ArtistIndexes, error) {
|
||||
func (r *artistIndexRepository) GetAll() (domain.ArtistIndexes, error) {
|
||||
var indices = make(domain.ArtistIndexes, 0)
|
||||
err := r.loadAll(&indices, domain.QueryOptions{Alpha: true})
|
||||
return &indices, err
|
||||
return indices, err
|
||||
}
|
||||
|
||||
var _ domain.ArtistIndexRepository = (*artistIndexRepository)(nil)
|
||||
|
||||
@@ -57,7 +57,7 @@ func TestIndexRepository(t *testing.T) {
|
||||
So(indices, ShouldHaveLength, 4)
|
||||
})
|
||||
Convey("And the values should be retrieved", func() {
|
||||
for _, e := range *indices {
|
||||
for _, e := range indices {
|
||||
So(e.Id, ShouldBeIn, []string{"1", "2", "3", "4"})
|
||||
}
|
||||
})
|
||||
|
||||
@@ -30,9 +30,9 @@ func (m *MockArtistIndex) SetData(j string, length int) {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *MockArtistIndex) GetAll() (*domain.ArtistIndexes, error) {
|
||||
func (m *MockArtistIndex) GetAll() (domain.ArtistIndexes, error) {
|
||||
if m.err {
|
||||
return nil, errors.New("Error!")
|
||||
}
|
||||
return &m.data, nil
|
||||
return m.data, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user