code upgrade
This commit is contained in:
@ -15,10 +15,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ParseStructField = parseStructField{}
|
||||
ParseStructFieldTag = parseStructFieldTag{}
|
||||
)
|
||||
|
||||
type parseStructField struct {
|
||||
type parseStructFieldTag struct {
|
||||
}
|
||||
|
||||
// GetParamName 获取参数名称
|
||||
@ -26,7 +26,7 @@ type parseStructField struct {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 21:58 2025/2/11
|
||||
func (psf parseStructField) GetParamName(structField reflect.StructField) string {
|
||||
func (psf parseStructFieldTag) GetParamName(structField reflect.StructField) string {
|
||||
paramNameTagList := []string{
|
||||
define.TagJson, define.TagForm,
|
||||
define.TagXml, define.TagYaml,
|
||||
@ -49,7 +49,7 @@ func (psf parseStructField) GetParamName(structField reflect.StructField) string
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 22:01 2025/2/11
|
||||
func (psf parseStructField) GetParamDesc(structField reflect.StructField) string {
|
||||
func (psf parseStructFieldTag) GetParamDesc(structField reflect.StructField) string {
|
||||
descTagList := []string{define.TagDesc, define.TagDescription}
|
||||
for _, tag := range descTagList {
|
||||
tagVal := structField.Tag.Get(tag)
|
||||
@ -66,7 +66,7 @@ func (psf parseStructField) GetParamDesc(structField reflect.StructField) string
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 22:05 2025/2/11
|
||||
func (psf parseStructField) GetDefaultValue(structField reflect.StructField) any {
|
||||
func (psf parseStructFieldTag) GetDefaultValue(structField reflect.StructField) any {
|
||||
defaultTagList := []string{define.TagD, define.TagDefault}
|
||||
fieldType := structField.Type.Kind().String()
|
||||
for _, tag := range defaultTagList {
|
||||
@ -104,7 +104,7 @@ func (psf parseStructField) GetDefaultValue(structField reflect.StructField) any
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:30 2025/2/13
|
||||
func (psf parseStructField) GetValidateRule(structField reflect.StructField) string {
|
||||
func (psf parseStructFieldTag) 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 {
|
||||
@ -119,7 +119,7 @@ func (psf parseStructField) GetValidateRule(structField reflect.StructField) str
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 21:12 2025/2/13
|
||||
func (psf parseStructField) Deprecated(structField reflect.StructField) bool {
|
||||
func (psf parseStructFieldTag) Deprecated(structField reflect.StructField) bool {
|
||||
defaultTagList := []string{define.TagDeprecated}
|
||||
for _, tag := range defaultTagList {
|
||||
if tagVal, exist := structField.Tag.Lookup(tag); exist && (tagVal == "1" || strings.ToLower(tagVal) == "true") {
|
||||
@ -134,7 +134,7 @@ func (psf parseStructField) Deprecated(structField reflect.StructField) bool {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 15:15 2025/2/14
|
||||
func (psf parseStructField) Summary(structField reflect.StructField) string {
|
||||
func (psf parseStructFieldTag) Summary(structField reflect.StructField) string {
|
||||
defaultTagList := []string{define.TagSummary}
|
||||
for _, tag := range defaultTagList {
|
||||
if tagVal, exist := structField.Tag.Lookup(tag); exist && len(tagVal) > 0 {
|
||||
|
Reference in New Issue
Block a user