增加部分数据验证转化逻辑
This commit is contained in:
@ -25,83 +25,15 @@ func NewDefaultFieldRule(path string, dataType string, isRequired bool, defaultV
|
||||
AllowZero: true,
|
||||
RequiredConditionGroup: make([][]define.RequiredCondition, 0),
|
||||
ValueLimit: &define.ValueLimit{
|
||||
String: nil,
|
||||
Int: nil,
|
||||
Float: nil,
|
||||
Slice: nil,
|
||||
Map: nil,
|
||||
EnumList: make([]string, 0),
|
||||
Min: nil,
|
||||
Max: nil,
|
||||
String: &define.StringValueLimit{
|
||||
AutoTrimSpace: true,
|
||||
IncludeSubStrList: make([]string, 0),
|
||||
},
|
||||
Map: &define.MapValueLimit{IncludeFieldList: make([]string, 0)},
|
||||
},
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
// NewDefaultStringValueLimit ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:22 2024/4/29
|
||||
func NewDefaultStringValueLimit(minLength int64, maxLength int64) *define.StringValueLimit {
|
||||
l := &define.StringValueLimit{
|
||||
MinLength: minLength,
|
||||
MaxLength: maxLength,
|
||||
AutoTrimSpace: true,
|
||||
IncludeSubStrList: make([]string, 0),
|
||||
EnumList: make([]string, 0),
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
// NewDefaultIntValueLimit ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:24 2024/4/29
|
||||
func NewDefaultIntValueLimit(min *int64, max *int64) *define.IntValueLimit {
|
||||
l := &define.IntValueLimit{
|
||||
Min: min,
|
||||
Max: max,
|
||||
EnumList: make([]int64, 0),
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
// NewDefaultFloatValueLimit ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:27 2024/4/29
|
||||
func NewDefaultFloatValueLimit(min *float64, max *float64) *define.FloatValueLimit {
|
||||
l := &define.FloatValueLimit{
|
||||
Min: min,
|
||||
Max: max,
|
||||
EnumList: make([]float64, 0),
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
// NewDefaultSliceValueLimit ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:30 2024/4/29
|
||||
func NewDefaultSliceValueLimit(minLength int64, maxLength int64) *define.SliceValueLimit {
|
||||
l := &define.SliceValueLimit{
|
||||
MinLength: minLength,
|
||||
MaxLength: maxLength,
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
||||
// NewDefaultMapValueLimit ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 12:30 2024/4/29
|
||||
func NewDefaultMapValueLimit(minLength int64, maxLength int64) *define.MapValueLimit {
|
||||
l := &define.MapValueLimit{
|
||||
MinLength: minLength,
|
||||
MaxLength: maxLength,
|
||||
IncludeFieldList: make([]string, 0),
|
||||
}
|
||||
return l
|
||||
}
|
||||
|
Reference in New Issue
Block a user