More tests, more refactoring, more reflection (ugh)
This commit is contained in:
@@ -2,7 +2,7 @@ package repositories
|
||||
|
||||
import (
|
||||
"github.com/deluan/gosonic/models"
|
||||
"errors"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type ArtistIndex struct {
|
||||
@@ -11,7 +11,7 @@ type ArtistIndex struct {
|
||||
|
||||
func NewArtistIndexRepository() *ArtistIndex {
|
||||
r := &ArtistIndex{}
|
||||
r.table = "index"
|
||||
r.init("index", &models.ArtistIndex{})
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -22,14 +22,16 @@ func (r *ArtistIndex) Put(m *models.ArtistIndex) error {
|
||||
return r.saveOrUpdate(m.Id, m)
|
||||
}
|
||||
|
||||
func (r*ArtistIndex) Get(id string) (*models.ArtistIndex, error) {
|
||||
entity := &models.ArtistIndex{}
|
||||
err := r.loadEntity(id, entity)
|
||||
return entity, err
|
||||
func (r *ArtistIndex) Get(id string) (*models.ArtistIndex, error) {
|
||||
var rec interface{}
|
||||
rec, err := r.readEntity(id)
|
||||
return rec.(*models.ArtistIndex), err
|
||||
}
|
||||
|
||||
func (r*ArtistIndex) GetAll() ([]*models.ArtistIndex, error) {
|
||||
return nil, errors.New("Not Implemented")
|
||||
func (r *ArtistIndex) GetAll() ([]models.ArtistIndex, error) {
|
||||
var indices = make([]models.ArtistIndex, 30)
|
||||
err := r.loadAll(&indices)
|
||||
return indices, err
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user