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

feat: Support Object value type in Reading #1025

Merged
merged 4 commits into from
Oct 6, 2021
Merged

feat: Support Object value type in Reading #1025

merged 4 commits into from
Oct 6, 2021

Conversation

weichou1229
Copy link
Member

@weichou1229 weichou1229 commented Oct 4, 2021

Closes #1024

Signed-off-by: bruce [email protected]

PR Checklist

Please check if your PR fulfills the following requirements:

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/device-sdk-c/blob/master/.github/CONTRIBUTING.md

What is the current behavior?

Issue Number: #1024

What is the new behavior?

Handle the object value type for the event reading

Does this PR introduce a breaking change?

  • Yes
  • No

New Imports

  • Yes
  • No

Specific Instructions

Other information

Handle the object value type for the event reading

Closes #1024

Signed-off-by: bruce <[email protected]>
@weichou1229
Copy link
Member Author

This PR should hold until edgexfoundry/go-mod-core-contracts#666 merged.

@@ -429,6 +429,16 @@ func (cv *CommandValue) BinaryValue() ([]byte, error) {
return value, nil
}

// ObjectValue returns the value in object data type, and returns error if the Type is not Object.
func (cv *CommandValue) ObjectValue() (interface{}, error) {
var value float64
Copy link
Member

Choose a reason for hiding this comment

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

Why using float64 here and not interface{}?
I see that it is a noop for the error, but it makes the code confusing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, it's redundant, removed.

@lenny-goodell
Copy link
Member

@weichou1229 Please reference the Docs PR for this enhancement in the PR.

@weichou1229
Copy link
Member Author

@weichou1229 Please reference the Docs PR for this enhancement in the PR.

Added the link.

lenny-goodell
lenny-goodell previously approved these changes Oct 5, 2021
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

LGTM

@weichou1229
Copy link
Member Author

Upgrade the core-contracts lib from v2.0.1-dev.18 to v2.0.1-dev.19

@codecov-commenter
Copy link

Codecov Report

Merging #1025 (db48cce) into main (1b99335) will increase coverage by 0.04%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1025      +/-   ##
==========================================
+ Coverage   40.70%   40.75%   +0.04%     
==========================================
  Files          29       29              
  Lines        3002     3011       +9     
==========================================
+ Hits         1222     1227       +5     
- Misses       1686     1690       +4     
  Partials       94       94              
Impacted Files Coverage Δ
internal/transformer/transform.go 6.31% <0.00%> (-0.14%) ⬇️
pkg/models/commandvalue.go 84.52% <71.42%> (-0.30%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a03e475...db48cce. Read the comment docs.

Copy link
Member

@cloudxxx8 cloudxxx8 left a comment

Choose a reason for hiding this comment

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

LGTM

@cloudxxx8 cloudxxx8 merged commit d245461 into edgexfoundry:main Oct 6, 2021
@weichou1229 weichou1229 deleted the issue-1024 branch October 19, 2021 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support object value types in Reading
4 participants