|
@@ -34,6 +34,9 @@ func parseVal(from, to reflect.Value, fieldName string) IErrorArgs {
|
|
|
|
|
|
func parseType(from, to reflect.Value, fieldName string) IErrorArgs {
|
|
|
from = realValue(from)
|
|
|
+ if !from.IsValid() {
|
|
|
+ return nil
|
|
|
+ }
|
|
|
to = realValue(to)
|
|
|
tn := StructTypeName(to)
|
|
|
cv, check := fieldConverters[tn]
|
|
@@ -70,6 +73,7 @@ func parseType(from, to reflect.Value, fieldName string) IErrorArgs {
|
|
|
|
|
|
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 {
|
|
|
val.Set(reflect.New(val.Type().Elem()))
|
|
|
}
|
|
@@ -143,12 +147,6 @@ loop:
|
|
|
rVal = from.FieldByName(fType.Name)
|
|
|
}
|
|
|
case reflect.Map:
|
|
|
- /*
|
|
|
- log.Println(fType.Name)
|
|
|
- if rVal = from.MapIndex(reflect.ValueOf(strings.ToLower(fType.Name))); !rVal.IsValid() {
|
|
|
- rVal = from.MapIndex(reflect.ValueOf(fType.Name))
|
|
|
- }
|
|
|
- */
|
|
|
mapKeys := from.MapKeys()
|
|
|
lowerFTypeName := strings.ToLower(fType.Name)
|
|
|
for _, key := range mapKeys {
|