Revert "Merge remote-tracking branch 'upstream/gva_gormv2_dev' into gva_gormv2_dev"
This reverts commit bb33c312b13577fef786a91e0369468d65364b6f, reversing changes made to b9b4bc6b8b7a9b23efd4dab4cf38110c142cde76.
This commit is contained in:
@@ -3,7 +3,6 @@ package utils
|
||||
import (
|
||||
"errors"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
@@ -38,15 +37,6 @@ func NotEmpty() string {
|
||||
return "notEmpty"
|
||||
}
|
||||
|
||||
//@author: [zooqkl](https://github.com/zooqkl)
|
||||
//@function: RegexpMatch
|
||||
//@description: 正则校验 校验输入项是否满足正则表达式
|
||||
//@param: rule string
|
||||
//@return: string
|
||||
func RegexpMatch(rule string) string {
|
||||
return "regexp=" + rule
|
||||
}
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: Lt
|
||||
//@description: 小于入参(<) 如果为string array Slice则为长度比较 如果是 int uint float 则为数值比较
|
||||
@@ -143,10 +133,6 @@ func Verify(st interface{}, roleMap Rules) (err error) {
|
||||
if isBlank(val) {
|
||||
return errors.New(tagVal.Name + "值不能为空")
|
||||
}
|
||||
case strings.Split(v, "=")[0] == "regexp":
|
||||
if !regexpMatch(strings.Split(v, "=")[1], val.String()) {
|
||||
return errors.New(tagVal.Name + "格式校验不通过")
|
||||
}
|
||||
case compareMap[strings.Split(v, "=")[0]]:
|
||||
if !compareVerify(val, v) {
|
||||
return errors.New(tagVal.Name + "长度或值不在合法范围," + v)
|
||||
@@ -280,7 +266,3 @@ func compare(value interface{}, VerifyStr string) bool {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func regexpMatch(rule, matchStr string) bool {
|
||||
return regexp.MustCompile(rule).MatchString(matchStr)
|
||||
}
|
||||
|
Reference in New Issue
Block a user