Introduced interfaces for all repositories, completely isolating the persistence layer from the repositories usage and specification
This commit is contained in:
@@ -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
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package domain
|
||||
|
||||
type BaseRepository interface {
|
||||
NewId(fields ...string) string
|
||||
CountAll() (int, error)
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ type ArtistIndex struct {
|
||||
|
||||
|
||||
type ArtistIndexRepository interface {
|
||||
BaseRepository
|
||||
Put(m *ArtistIndex) error
|
||||
Get(id string) (*ArtistIndex, error)
|
||||
GetAll() ([]ArtistIndex, error)
|
||||
|
||||
@@ -15,4 +15,9 @@ type MediaFile struct {
|
||||
Compilation bool
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
}
|
||||
|
||||
type MediaFileRepository interface {
|
||||
BaseRepository
|
||||
Put(m *MediaFile) error
|
||||
}
|
||||
@@ -4,4 +4,9 @@ type MediaFolder struct {
|
||||
Id string
|
||||
Name string
|
||||
Path string
|
||||
}
|
||||
}
|
||||
|
||||
type MediaFolderRepository interface {
|
||||
GetAll() ([]MediaFolder, error)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user