-
Notifications
You must be signed in to change notification settings - Fork 26
fix(scalar): Handle nil pointer to []byte in uuid and binary #922
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
Conversation
⏱️ Benchmark results
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #922 +/- ##
==========================================
+ Coverage 51.25% 51.79% +0.54%
==========================================
Files 62 62
Lines 6183 6197 +14
==========================================
+ Hits 3169 3210 +41
+ Misses 2729 2702 -27
Partials 285 285
☔ View full report in Codecov by Sentry. |
8052b18 to
42b3800
Compare
| var nilPointerFloat32 *float32 | ||
| var nilPointerFloat64 *float64 | ||
|
|
||
| func TestFloatAllWidthsSet(t *testing.T) { |
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.
Renamed TestFloat32Set to TestFloatAllWidthsSet
| {source: "1", result: Float{Value: 1, Valid: true}}, | ||
| {source: _int8(1), result: Float{Value: 1, Valid: true}}, | ||
| {source: &Float{Value: 1, Valid: true}, result: Float{Value: 1, Valid: true}}, | ||
| {source: nilPointerInt8, result: Float{Valid: false}}, |
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.
Maybe we can remove TestFloat64Set altogether due to TestFloatAllWidthsSet
| case fmt.Stringer: | ||
| value2 := value.String() | ||
| return s.Set(value2) | ||
| case [16]byte: |
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.
I wonder if uuid.UUID should also be checked?...
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.
It works since uuid.UUID implements the Stringer interface
🤖 I have created a release *beep* *boop* --- ## [3.9.0](v3.8.1...v3.9.0) (2023-06-01) ### Features * More scalars ([#914](#914)) ([f8625e2](f8625e2)) ### Bug Fixes * **scalar:** Handle nil pointer to []byte in uuid and binary ([#922](#922)) ([dac967a](dac967a)) * **testdata:** Match map field names with type ([#930](#930)) ([cec067d](cec067d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Follow up to #922. 2 more tests. The tests pass since `uuid.UUID` implements the `Stringer` interface ---
Summary
Follow up to #922 to handle nil
*[]byte]inuuidandbinary.Also added some tests to floats I can extract to another PR.
This is required for supporting
nilvalues in cloudquery/cloudquery#11115.Discovered by generating test data with the 2 rows option cc @candiduslynx.
Use the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)