Moved properties to engine layer
This commit is contained in:
@@ -2,21 +2,22 @@ package persistence
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/deluan/gosonic/domain"
|
||||
|
||||
"github.com/deluan/gosonic/engine"
|
||||
)
|
||||
|
||||
type propertyRepository struct {
|
||||
ledisRepository
|
||||
}
|
||||
|
||||
func NewPropertyRepository() domain.PropertyRepository {
|
||||
func NewPropertyRepository() engine.PropertyRepository {
|
||||
r := &propertyRepository{}
|
||||
r.init("property", &domain.Property{})
|
||||
r.init("property", &engine.Property{})
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *propertyRepository) Put(id string, value string) error {
|
||||
m := &domain.Property{Id: id, Value: value}
|
||||
m := &engine.Property{Id: id, Value: value}
|
||||
if m.Id == "" {
|
||||
return errors.New("Id is required")
|
||||
}
|
||||
@@ -26,7 +27,7 @@ func (r *propertyRepository) Put(id string, value string) error {
|
||||
func (r *propertyRepository) Get(id string) (string, error) {
|
||||
var rec interface{}
|
||||
rec, err := r.readEntity(id)
|
||||
return rec.(*domain.Property).Value, err
|
||||
return rec.(*engine.Property).Value, err
|
||||
}
|
||||
|
||||
func (r *propertyRepository) DefaultGet(id string, defaultValue string) (string, error) {
|
||||
@@ -39,4 +40,4 @@ func (r *propertyRepository) DefaultGet(id string, defaultValue string) (string,
|
||||
return v, err
|
||||
}
|
||||
|
||||
var _ domain.PropertyRepository = (*propertyRepository)(nil)
|
||||
var _ engine.PropertyRepository = (*propertyRepository)(nil)
|
||||
|
||||
Reference in New Issue
Block a user