[feat] 移除 ResFieldByMap, ResFieldByAnys 类型

This commit is contained in:
what 2023-06-23 00:12:10 +08:00
parent 6ccef0fbb8
commit 0bf1b9dd39
2 changed files with 7 additions and 7 deletions

View File

@ -112,7 +112,7 @@ func (this *QueryField) ToStructField(tags ...string) reflect.StructField {
case contracts.QueryDataType_Bool: case contracts.QueryDataType_Bool:
typ = reflect.TypeOf(true) typ = reflect.TypeOf(true)
case contracts.QueryDataType_Array: case contracts.QueryDataType_Array:
typ = reflect.TypeOf(res_type.ResFieldByAnys{}) typ = reflect.TypeOf([]any{})
case contracts.QueryDataType_Json: case contracts.QueryDataType_Json:
typ = reflect.TypeOf(map[string]any{}) typ = reflect.TypeOf(map[string]any{})
} }

View File

@ -111,12 +111,6 @@ func (this ResField) ToValue(v any) any {
v = float64(data) v = float64(data)
case string: case string:
v = strings.Trim(string(data), " ") v = strings.Trim(string(data), " ")
case res_type.ResFieldByAnys:
if v != nil {
b, _ := json.Marshal(v)
return string(b)
}
v = []any(data)
case []any, []string, []int, []float64, []float32, []int64: case []any, []string, []int, []float64, []float32, []int64:
if v != nil { if v != nil {
b, _ := json.Marshal(v) b, _ := json.Marshal(v)
@ -129,6 +123,12 @@ func (this ResField) ToValue(v any) any {
return string(b) return string(b)
} }
v = data v = data
default:
if v != nil {
b, _ := json.Marshal(v)
return string(b)
}
v = data
} }
switch this.DataType { switch this.DataType {