Преглед изворни кода

修改原session.Qeury()API

xormplus пре 10 година
родитељ
комит
2484a741e1
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      helpersplus.go

+ 2 - 2
helpersplus.go

@@ -30,7 +30,7 @@ func reflect2objectWithDateFormat(rawValue *reflect.Value, dateFormat string) (v
 		}
 		}
 	//时间类型
 	//时间类型
 	case reflect.Struct:
 	case reflect.Struct:
-		if aa == core.TimeType {
+		if aa.ConvertibleTo(core.TimeType) {
 			//			loc, _ := time.LoadLocation("Local")                            //重要:获取时区
 			//			loc, _ := time.LoadLocation("Local")                            //重要:获取时区
 			//			value, _ = time.ParseInLocation(dateFormat, rawValue.Interface().(time.Time).Format(dateFormat), loc)
 			//			value, _ = time.ParseInLocation(dateFormat, rawValue.Interface().(time.Time).Format(dateFormat), loc)
 			value = rawValue.Interface().(time.Time).Format(dateFormat)
 			value = rawValue.Interface().(time.Time).Format(dateFormat)
@@ -179,7 +179,7 @@ func reflect2object(rawValue *reflect.Value) (value interface{}, err error) {
 		}
 		}
 	//时间类型
 	//时间类型
 	case reflect.Struct:
 	case reflect.Struct:
-		if aa == core.TimeType {
+		if aa.ConvertibleTo(core.TimeType) {
 			value = rawValue.Interface().(time.Time)
 			value = rawValue.Interface().(time.Time)
 		} else {
 		} else {
 			err = fmt.Errorf("Unsupported struct type %v", vv.Type().Name())
 			err = fmt.Errorf("Unsupported struct type %v", vv.Type().Name())