增加对 Slice 类型数据的绑定

This commit is contained in:
Havoc412 2024-11-13 18:55:05 +08:00
parent 568bb72e13
commit bbd55d4223

View File

@ -73,6 +73,8 @@ func fieldSetValue(c *gin.Context, valueOf reflect.Value, typeOf reflect.Type, c
valueOf.Field(colIndex).SetString(c.GetString(relaKey))
case reflect.Bool:
valueOf.Field(colIndex).SetBool(c.GetBool(relaKey))
case reflect.Slice:
valueOf.Field(colIndex).Set(reflect.ValueOf(c.GetStringSlice(relaKey)))
default:
// model 如果有日期时间字段,请统一设置为字符串即可
}