|
@@ -2,7 +2,6 @@ package rest
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
- "log"
|
|
|
"reflect"
|
|
|
"strings"
|
|
|
|
|
@@ -76,7 +75,6 @@ func realValue(val reflect.Value) reflect.Value {
|
|
|
if val.Kind() == reflect.Ptr || val.Kind() == reflect.Interface {
|
|
|
//if val.Kind() == reflect.Interface {
|
|
|
if val.IsNil() && val.Kind() == reflect.Ptr {
|
|
|
- log.Println(val.Type())
|
|
|
val.Set(reflect.New(val.Type().Elem()))
|
|
|
}
|
|
|
// check
|
|
@@ -238,14 +236,11 @@ func parseMap(from, to reflect.Value, fieldName string) IErrorArgs {
|
|
|
|
|
|
// Serialize преобразует словарь from в объект произвольного типа
|
|
|
func Serialize(from json.Map, to any) IErrorArgs {
|
|
|
- log.Println("serialize", from, to)
|
|
|
- log.Println(reflect.ValueOf(to).Type())
|
|
|
elemTo := reflect.ValueOf(to).Elem()
|
|
|
res := parseType(
|
|
|
reflect.ValueOf(&from),
|
|
|
elemTo,
|
|
|
"",
|
|
|
)
|
|
|
- log.Println("sres", res)
|
|
|
return res
|
|
|
}
|