Introduced interfaces for all repositories, completely isolating the persistence layer from the repositories usage and specification

This commit is contained in:
Deluan
2016-03-02 09:33:49 -05:00
parent 272a499c7e
commit 300ed0d9a4
15 changed files with 83 additions and 48 deletions
+6
View File
@@ -8,4 +8,10 @@ type Album struct {
Year int
Compilation bool
Rating int
}
type AlbumRepository interface {
BaseRepository
Put(m *Album) error
Get(id string) (*Album, error)
}
+9 -1
View File
@@ -3,4 +3,12 @@ package domain
type Artist struct {
Id string
Name string
}
}
type ArtistRepository interface {
BaseRepository
Put(m *Artist) error
Get(id string) (*Artist, error)
GetByName(name string) (*Artist, error)
}
+8
View File
@@ -0,0 +1,8 @@
package domain
type BaseRepository interface {
NewId(fields ...string) string
CountAll() (int, error)
}
+1
View File
@@ -12,6 +12,7 @@ type ArtistIndex struct {
type ArtistIndexRepository interface {
BaseRepository
Put(m *ArtistIndex) error
Get(id string) (*ArtistIndex, error)
GetAll() ([]ArtistIndex, error)
+5
View File
@@ -15,4 +15,9 @@ type MediaFile struct {
Compilation bool
CreatedAt time.Time
UpdatedAt time.Time
}
type MediaFileRepository interface {
BaseRepository
Put(m *MediaFile) error
}
+6 -1
View File
@@ -4,4 +4,9 @@ type MediaFolder struct {
Id string
Name string
Path string
}
}
type MediaFolderRepository interface {
GetAll() ([]MediaFolder, error)
}