Skip to content

Commit

Permalink
import
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyincheng committed Oct 31, 2020
1 parent cd14775 commit 72f08b7
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions filter/filter_impl/generic_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,16 @@ func struct2MapAll(obj interface{}) interface{} {
if t.Kind() == reflect.Struct {
result := make(map[string]interface{}, t.NumField())
for i := 0; i < t.NumField(); i++ {
switch v.Field(i).Kind() {
case reflect.Struct:
fallthrough
case reflect.Slice:
fallthrough
case reflect.Map:
kind := v.Field(i).Kind()
if kind == reflect.Struct || kind == reflect.Slice || kind == reflect.Map {
if v.Field(i).CanInterface() {
if v.Field(i).Type().String() == "time.Time" {
setInMap(result, t.Field(i), v.Field(i).Interface())
break
}
setInMap(result, t.Field(i), struct2MapAll(v.Field(i).Interface()))
}
break
default:
} else {
if v.Field(i).CanInterface() {
setInMap(result, t.Field(i), v.Field(i).Interface())
}
Expand Down

0 comments on commit 72f08b7

Please sign in to comment.