参数增加必传解析

This commit is contained in:
2025-02-13 16:03:31 +08:00
parent 0e4f5ae1e3
commit bc5a8afd6c
4 changed files with 85 additions and 16 deletions

View File

@ -71,3 +71,18 @@ func (psf parseStructField) GetDefaultValue(structField reflect.StructField) str
}
return ""
}
// GetValidateRule 获取验证规则
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 15:30 2025/2/13
func (psf parseStructField) GetValidateRule(structField reflect.StructField) string {
defaultTagList := []string{define.TagValidate, define.TagBinding}
for _, tag := range defaultTagList {
if tagVal, exist := structField.Tag.Lookup(tag); exist && len(tagVal) > 0 {
return tagVal
}
}
return ""
}