支持marshal类型参数解析

This commit is contained in:
白茶清欢 2024-06-23 13:18:16 +08:00
parent 505a41edb5
commit 7c5e51aa9a
1 changed files with 8 additions and 6 deletions

14
run.go
View File

@ -251,17 +251,19 @@ func handleData(inputVal any, rule *define.FieldRule) (any, error) {
return handleString(inputVal, rule) return handleString(inputVal, rule)
case consts.DataTypeBool: case consts.DataTypeBool:
return handleBool(inputVal, rule) return handleBool(inputVal, rule)
case consts.DataTypeMapStrFloat, consts.DataTypeMapStrBool, case consts.DataTypeMapStrFloat, consts.DataTypeMapStrFloatWithMarshal,
consts.DataTypeMapStrInt, consts.DataTypeMapStrUint: consts.DataTypeMapStrBool, consts.DataTypeMapStrBoolWithMarshal,
consts.DataTypeMapStrInt, consts.DataTypeMapStrIntWithMarshal,
consts.DataTypeMapStrUint, consts.DataTypeMapStrUintWithMarshal:
// 一律按照 map[string]float64处理 // 一律按照 map[string]float64处理
return handleMapStringFloat(inputVal, rule) return handleMapStringFloat(inputVal, rule)
case consts.DataTypeMapStrAny: // 对象结构 case consts.DataTypeMapStrAny, consts.DataTypeMapStrAnyWithMarshal: // 对象结构
return handleMapStringAny(inputVal, rule) return handleMapStringAny(inputVal, rule)
case consts.DataTypeMapStrStr: // 对象结构 case consts.DataTypeMapStrStr, consts.DataTypeMapStrStrWithMarshal: // 对象结构
return handleMapStringString(inputVal, rule) return handleMapStringString(inputVal, rule)
case consts.DataTypeMapStrSlice: // map列表 case consts.DataTypeMapStrSlice, consts.DataTypeMapStrSliceWithMarshal: // map列表
return handleMapStringSlice(inputVal, rule) return handleMapStringSlice(inputVal, rule)
case consts.DataTypeMapAnyAny: // 任意类型map case consts.DataTypeMapAnyAny, consts.DataTypeMapAnyAnyWithMarshal: // 任意类型map
return handleMapAnyAny(inputVal, rule) return handleMapAnyAny(inputVal, rule)
case consts.DataTypeSliceInt, consts.DataTypeSliceIntWithChar: // int数组处理 case consts.DataTypeSliceInt, consts.DataTypeSliceIntWithChar: // int数组处理
return handleSliceInt(inputVal, rule) return handleSliceInt(inputVal, rule)