-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix:generic struct2MapAll #822
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check fail bro
Codecov Report
@@ Coverage Diff @@
## develop #822 +/- ##
===========================================
+ Coverage 59.85% 60.14% +0.28%
===========================================
Files 260 260
Lines 12762 12770 +8
===========================================
+ Hits 7639 7680 +41
+ Misses 4164 4133 -31
+ Partials 959 957 -2
Continue to review full report at Codecov.
|
filter/filter_impl/generic_filter.go
Outdated
if v.Field(i).Kind() == reflect.Struct || v.Field(i).Kind() == reflect.Slice || v.Field(i).Kind() == reflect.Map { | ||
switch v.Field(i).Kind() { | ||
case reflect.Struct: | ||
fallthrough |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
骚气蓬勃的用法,方哥。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用法没问题,但是会降低执行效率
72f08b7
to
7e0df5a
Compare
filter/filter_impl/generic_filter.go
Outdated
if value.CanInterface() { | ||
if value.Type().String() == "time.Time" { | ||
setInMap(result, field, value.Interface()) | ||
break |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be continue
filter/filter_impl/generic_filter.go
Outdated
kind := value.Kind() | ||
if kind == reflect.Struct || kind == reflect.Slice || kind == reflect.Map { | ||
if value.CanInterface() { | ||
if value.Type().String() == "time.Time" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a type check expression would be better: switch v := param.(type)
, I think there are other structs will be added, especially these in golang sdk.
fix generic struct2MapAll
What this PR does:
fix generic struct2MapAll
Which issue(s) this PR fixes:
Fixes #801