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