Move mapping functions to db_ledis, where it is used

This commit is contained in:
Deluan
2020-01-11 14:34:33 -05:00
committed by Deluan Quintão
parent 52fc580a2b
commit 93ab4132fe
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -26,7 +26,7 @@ func (r *ledisRepository) init(table string, entity interface{}) {
r.table = table
r.entityType = reflect.TypeOf(entity).Elem()
h, _ := utils.ToMap(entity)
h, _ := toMap(entity)
r.fieldNames = make([]string, len(h))
i := 0
for k := range h {
@@ -160,7 +160,7 @@ func (r *ledisRepository) saveOrUpdate(id string, entity interface{}) error {
recordPrefix := fmt.Sprintf("%s:%s:", r.table, id)
allKey := r.table + "s:all"
h, err := utils.ToMap(entity)
h, err := toMap(entity)
if err != nil {
return err
}
@@ -274,7 +274,7 @@ func (r *ledisRepository) toEntity(response [][]byte, entity interface{}) error
}
}
return utils.ToStruct(record, entity)
return toStruct(record, entity)
}
func (r *ledisRepository) loadRange(idxName string, min interface{}, max interface{}, entities interface{}, qo ...domain.QueryOptions) error {