fix(scalar): Handle nil pointer to []byte in uuid and binary#922
Merged
kodiakhq[bot] merged 1 commit intocloudquery:mainfrom Jun 1, 2023
Merged
fix(scalar): Handle nil pointer to []byte in uuid and binary#922kodiakhq[bot] merged 1 commit intocloudquery:mainfrom
kodiakhq[bot] merged 1 commit intocloudquery:mainfrom
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. |
yevgenypats
approved these changes
Jun 1, 2023
candiduslynx
approved these changes
Jun 1, 2023
8052b18 to
42b3800
Compare
erezrokah
commented
Jun 1, 2023
| var nilPointerFloat32 *float32 | ||
| var nilPointerFloat64 *float64 | ||
|
|
||
| func TestFloatAllWidthsSet(t *testing.T) { |
Member
Author
There was a problem hiding this comment.
Renamed TestFloat32Set to TestFloatAllWidthsSet
erezrokah
commented
Jun 1, 2023
| {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}}, |
Member
Author
There was a problem hiding this comment.
Maybe we can remove TestFloat64Set altogether due to TestFloatAllWidthsSet
candiduslynx
approved these changes
Jun 1, 2023
candiduslynx
reviewed
Jun 1, 2023
| @@ -63,8 +63,15 @@ func (s *UUID) Set(src any) error { | |||
| return s.Set(value2) | |||
| case [16]byte: | |||
Contributor
There was a problem hiding this comment.
I wonder if uuid.UUID should also be checked?...
Member
Author
There was a problem hiding this comment.
It works since uuid.UUID implements the Stringer interface
candiduslynx
reviewed
Jun 1, 2023
kodiakhq bot
pushed a commit
that referenced
this pull request
Jun 1, 2023
🤖 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).
This was referenced Jun 1, 2023
kodiakhq bot
pushed a commit
that referenced
this pull request
Aug 23, 2023
Follow up to #922. 2 more tests. The tests pass since `uuid.UUID` implements the `Stringer` interface ---
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)