瀏覽代碼

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