mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-17 20:42:25 +03:00
No need to expose implementations
This commit is contained in:
parent
78805ac465
commit
6092076fad
@ -11,30 +11,30 @@ type ArtistIndex interface {
|
||||
GetAll() ([]models.ArtistIndex, error)
|
||||
}
|
||||
|
||||
type ArtistIndexImpl struct {
|
||||
type artistIndex struct {
|
||||
BaseRepository
|
||||
}
|
||||
|
||||
func NewArtistIndexRepository() ArtistIndex {
|
||||
r := &ArtistIndexImpl{}
|
||||
r := &artistIndex{}
|
||||
r.init("index", &models.ArtistIndex{})
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *ArtistIndexImpl) Put(m *models.ArtistIndex) error {
|
||||
func (r *artistIndex) Put(m *models.ArtistIndex) error {
|
||||
if m.Id == "" {
|
||||
return errors.New("Id is not set")
|
||||
}
|
||||
return r.saveOrUpdate(m.Id, m)
|
||||
}
|
||||
|
||||
func (r *ArtistIndexImpl) Get(id string) (*models.ArtistIndex, error) {
|
||||
func (r *artistIndex) Get(id string) (*models.ArtistIndex, error) {
|
||||
var rec interface{}
|
||||
rec, err := r.readEntity(id)
|
||||
return rec.(*models.ArtistIndex), err
|
||||
}
|
||||
|
||||
func (r *ArtistIndexImpl) GetAll() ([]models.ArtistIndex, error) {
|
||||
func (r *artistIndex) GetAll() ([]models.ArtistIndex, error) {
|
||||
var indices = make([]models.ArtistIndex, 0)
|
||||
err := r.loadAll(&indices)
|
||||
return indices, err
|
||||
|
@ -11,17 +11,17 @@ type Property interface {
|
||||
DefaultGet(id string, defaultValue string) (string, error)
|
||||
}
|
||||
|
||||
type PropertyImpl struct {
|
||||
type property struct {
|
||||
BaseRepository
|
||||
}
|
||||
|
||||
func NewPropertyRepository() *PropertyImpl {
|
||||
r := &PropertyImpl{}
|
||||
func NewPropertyRepository() *property {
|
||||
r := &property{}
|
||||
r.init("property", &models.Property{})
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *PropertyImpl) Put(id string, value string) error {
|
||||
func (r *property) Put(id string, value string) error {
|
||||
m := &models.Property{Id: id, Value: value}
|
||||
if m.Id == "" {
|
||||
return errors.New("Id is required")
|
||||
@ -29,13 +29,13 @@ func (r *PropertyImpl) Put(id string, value string) error {
|
||||
return r.saveOrUpdate(m.Id, m)
|
||||
}
|
||||
|
||||
func (r *PropertyImpl) Get(id string) (string, error) {
|
||||
func (r *property) Get(id string) (string, error) {
|
||||
var rec interface{}
|
||||
rec, err := r.readEntity(id)
|
||||
return rec.(*models.Property).Value, err
|
||||
}
|
||||
|
||||
func (r* PropertyImpl) DefaultGet(id string, defaultValue string) (string, error) {
|
||||
func (r*property) DefaultGet(id string, defaultValue string) (string, error) {
|
||||
v, err := r.Get(id)
|
||||
|
||||
if v == "" {
|
||||
|
@ -13,7 +13,7 @@ func CreateMockArtistIndexRepo() *MockArtistIndex {
|
||||
}
|
||||
|
||||
type MockArtistIndex struct {
|
||||
repositories.ArtistIndexImpl
|
||||
repositories.ArtistIndex
|
||||
data []models.ArtistIndex
|
||||
err bool
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ func CreateMockPropertyRepo() *MockProperty {
|
||||
}
|
||||
|
||||
type MockProperty struct {
|
||||
repositories.PropertyImpl
|
||||
repositories.Property
|
||||
data map[string]string
|
||||
err bool
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user