39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
// Package validator ...
|
|
//
|
|
// Description : validator ...
|
|
//
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
//
|
|
// Date : 2024-04-29 12:18
|
|
package validator
|
|
|
|
import "git.zhangdeman.cn/gateway/validator/define"
|
|
|
|
// NewDefaultFieldRule ...
|
|
//
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
//
|
|
// Date : 14:01 2024/4/29
|
|
func NewDefaultFieldRule(path string, dataType string, isRequired bool, defaultValue string) *define.FieldRule {
|
|
r := &define.FieldRule{
|
|
Path: path,
|
|
Type: dataType,
|
|
DefaultValue: defaultValue,
|
|
IsRequired: isRequired,
|
|
AllowNil: false,
|
|
AllowEmpty: false,
|
|
AllowZero: true,
|
|
RequiredConditionGroup: make([][]define.RequiredCondition, 0),
|
|
ValueLimit: &define.ValueLimit{
|
|
EnumList: make([]string, 0),
|
|
Min: nil,
|
|
Max: nil,
|
|
String: &define.StringValueLimit{
|
|
IncludeSubStrList: make([]string, 0),
|
|
},
|
|
Map: &define.MapValueLimit{IncludeFieldList: make([]string, 0)},
|
|
},
|
|
}
|
|
return r
|
|
}
|