Refactoring to a cleaner architecture

This commit is contained in:
Deluan
2016-03-02 09:07:24 -05:00
parent 74478ce6f9
commit 272a499c7e
27 changed files with 120 additions and 120 deletions
+5 -6
View File
@@ -1,10 +1,9 @@
package mocks
import (
"github.com/deluan/gosonic/models"
"github.com/deluan/gosonic/domain"
"fmt"
"encoding/json"
"github.com/deluan/gosonic/repositories"
"errors"
)
@@ -13,8 +12,8 @@ func CreateMockArtistIndexRepo() *MockArtistIndex {
}
type MockArtistIndex struct {
repositories.ArtistIndex
data []models.ArtistIndex
domain.ArtistIndexRepository
data []domain.ArtistIndex
err bool
}
@@ -23,14 +22,14 @@ func (m *MockArtistIndex) SetError(err bool) {
}
func (m *MockArtistIndex) SetData(j string, length int) {
m.data = make([]models.ArtistIndex, length)
m.data = make([]domain.ArtistIndex, length)
err := json.Unmarshal([]byte(j), &m.data)
if err != nil {
fmt.Println("ERROR: ", err)
}
}
func (m *MockArtistIndex) GetAll() ([]models.ArtistIndex, error) {
func (m *MockArtistIndex) GetAll() ([]domain.ArtistIndex, error) {
if m.err {
return nil, errors.New("Error!")
}
+2 -2
View File
@@ -1,8 +1,8 @@
package mocks
import (
"github.com/deluan/gosonic/repositories"
"errors"
"github.com/deluan/gosonic/domain"
)
func CreateMockPropertyRepo() *MockProperty {
@@ -10,7 +10,7 @@ func CreateMockPropertyRepo() *MockProperty {
}
type MockProperty struct {
repositories.Property
domain.PropertyRepository
data map[string]string
err bool
}