Introduced types for the collections

This commit is contained in:
Deluan
2016-03-03 21:01:55 -05:00
parent eae9f3168f
commit fc6d49d34c
11 changed files with 29 additions and 21 deletions
+3 -3
View File
@@ -23,7 +23,7 @@ func (m *MockMediaFile) SetError(err bool) {
func (m *MockMediaFile) SetData(j string, size int) {
m.data = make(map[string]*domain.MediaFile)
var l = make([]domain.MediaFile, size)
var l = make(domain.MediaFiles, size)
err := json.Unmarshal([]byte(j), &l)
if err != nil {
fmt.Println("ERROR: ", err)
@@ -52,11 +52,11 @@ func (m *MockMediaFile) Get(id string) (*domain.MediaFile, error) {
return mf, nil
}
func (m *MockMediaFile) FindByAlbum(artistId string) ([]domain.MediaFile, error) {
func (m *MockMediaFile) FindByAlbum(artistId string) (domain.MediaFiles, error) {
if m.err {
return nil, errors.New("Error!")
}
var res = make([]domain.MediaFile, len(m.data))
var res = make(domain.MediaFiles, len(m.data))
i := 0
for _, a := range m.data {
if a.AlbumId == artistId {