Skip to content
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(encoding/form): optimize EncodeField and add test cases #3234

Merged
merged 2 commits into from
Mar 22, 2024

Conversation

demoManito
Copy link
Member

@demoManito demoManito commented Mar 12, 2024

Description (what this PR does / why we need it):

  • remove protoreflect.StringKind convert to string
    image

  • supplementary encode map test cases

Which issue(s) this PR fixes (resolves / be part of):

Other special notes for the reviewers:

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 12, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.63%. Comparing base (1ab258e) to head (bb52361).

❗ Current head bb52361 differs from pull request most recent head 9d25284. Consider uploading reports for the commit 9d25284 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3234      +/-   ##
==========================================
+ Coverage   81.54%   81.63%   +0.08%     
==========================================
  Files          91       91              
  Lines        4167     4165       -2     
==========================================
+ Hits         3398     3400       +2     
+ Misses        589      587       -2     
+ Partials      180      178       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

case protoreflect.BytesKind:
return base64.URLEncoding.EncodeToString(value.Bytes()), nil
case protoreflect.MessageKind, protoreflect.GroupKind:
return encodeMessage(fieldDescriptor.Message(), value)
default:
return fmt.Sprint(value.Interface()), nil
return value.String(), nil
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a feature or fix?

Copy link
Member Author

@demoManito demoManito Mar 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Not a feature or fix, optimized by the way.

value.String() already contains fmt.Sprint(value.Interface()), for non-special types just use .String()

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I'm talking about is the title issue

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@demoManito demoManito changed the title test(encoding/form): supplementary encode map test cases fix(encoding/form): EncodeField remove protoreflect.StringKind and supplementary encode map test cases Mar 16, 2024
@demoManito demoManito changed the title fix(encoding/form): EncodeField remove protoreflect.StringKind and supplementary encode map test cases fix(encoding/form): EncodeField remove protoreflect.StringKind and add encode map test cases Mar 16, 2024
@demoManito demoManito changed the title fix(encoding/form): EncodeField remove protoreflect.StringKind and add encode map test cases fix(encoding/form): EncodeField remove protoreflect.StringKind and add map test cases Mar 16, 2024
@demoManito demoManito changed the title fix(encoding/form): EncodeField remove protoreflect.StringKind and add map test cases fix(encoding/form): optimize EncodeField and add test cases Mar 22, 2024
@dosubot dosubot bot added the LGTM label Mar 22, 2024
@shenqidebaozi shenqidebaozi merged commit bfafeca into go-kratos:main Mar 22, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LGTM size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants