修复字段名解析对于omit的处理
This commit is contained in:
parent
670d2b5cb3
commit
6449c7399f
@ -30,4 +30,5 @@ const (
|
||||
TagErrMsg = "err" // 验证失败错误信息tag
|
||||
TagContentType = "content_type"
|
||||
TagOutputContentType = "output_content_type"
|
||||
TagNameOmitempty = "omitempty"
|
||||
)
|
||||
|
@ -34,7 +34,9 @@ func (psf parseStructField) GetParamName(structField reflect.StructField) string
|
||||
}
|
||||
for _, tag := range paramNameTagList {
|
||||
tagVal := structField.Tag.Get(tag)
|
||||
if tagVal != "" {
|
||||
tagVal = strings.TrimSuffix(strings.TrimPrefix(tagVal, define.TagNameOmitempty+","), ","+define.TagNameOmitempty)
|
||||
tagVal = strings.Trim(tagVal, ",")
|
||||
if tagVal != "" && tagVal != define.TagNameOmitempty {
|
||||
return tagVal
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user