Skip to content

Commit 25dfb33

Browse files
committed
🔥 删除无用的取值代码
1 parent f126229 commit 25dfb33

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

filter/parser.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func (t *fieldNodeTree) parseAny(key, scene string, valueOf reflect.Value, isSel
1414
typeOf := valueOf.Type()
1515
TakePointerValue: //取指针的值
1616
switch typeOf.Kind() {
17-
case reflect.Ptr: //如果是指针类型则取地址重新判断类型
17+
case reflect.Ptr: //如果是指针类型则取值重新判断类型
1818
valueOf = valueOf.Elem()
1919
typeOf = typeOf.Elem()
2020
goto TakePointerValue
@@ -110,12 +110,6 @@ func getSelectTag(scene string, pkgInfo string, i int, typeOf reflect.Type) tagI
110110
}
111111

112112
func parserMap(valueOf reflect.Value, t *fieldNodeTree, scene string, isSelect bool) {
113-
114-
takeVMap:
115-
if valueOf.Kind() == reflect.Ptr {
116-
valueOf = valueOf.Elem()
117-
goto takeVMap
118-
}
119113
keys := valueOf.MapKeys()
120114
if len(keys) == 0 { //空map情况下解析为{}
121115
t.Val = struct{}{}
@@ -165,18 +159,6 @@ func parserBaseType(valueOf reflect.Value, t *fieldNodeTree, key string) {
165159
}
166160

167161
func parserStruct(typeOf reflect.Type, valueOf reflect.Value, t *fieldNodeTree, scene string, key string, isSelect bool) {
168-
169-
TakeValueOfPointerValue: //这里主要是考虑到有可能用的不是一级指针,如果是***int 等多级指针就需要不断的取值
170-
if valueOf.Kind() == reflect.Ptr {
171-
if valueOf.IsNil() {
172-
t.IsNil = true
173-
return
174-
} else {
175-
valueOf = valueOf.Elem()
176-
goto TakeValueOfPointerValue
177-
}
178-
}
179-
180162
if valueOf.CanConvert(timeTypes) { //是time.Time类型或者底层是time.Time类型
181163
t.Key = key
182164
t.Val = valueOf.Interface()
@@ -263,7 +245,6 @@ TakeValueOfPointerValue: //这里主要是考虑到有可能用的不是一级
263245
}
264246

265247
func parserSliceOrArray(typeOf reflect.Type, valueOf reflect.Value, t *fieldNodeTree, scene string, key string, isSelect bool) {
266-
267248
val1 := valueOf.Interface()
268249
ok := valueOf.CanConvert(byteTypes)
269250
if ok {

0 commit comments

Comments
 (0)