Skip to content

fix: Validate json strings and handle empty strings#497

Merged
kodiakhq[bot] merged 3 commits intomainfrom
fix/empty_json
Dec 13, 2022
Merged

fix: Validate json strings and handle empty strings#497
kodiakhq[bot] merged 3 commits intomainfrom
fix/empty_json

Conversation

@yevgenypats
Copy link
Copy Markdown
Contributor

*dst = JSON{Bytes: []byte(value), Status: Present}
case *string:
if value == nil {
*dst = JSON{Status: Null}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should return here I think

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's going out of the switch case so it's fine. Not the most consistent code because it's started with switch case the original code from pgtype and now we have more cases where I had to return. Not sure if better to change everything to return.

@yevgenypats yevgenypats requested a review from bbernays December 13, 2022 18:24
@yevgenypats yevgenypats mentioned this pull request Dec 13, 2022
5 tasks
@github-actions
Copy link
Copy Markdown

⏱️ Benchmark results

Comparing with 7154bd0

  • DefaultConcurrency-2 resources/s: 11,839 ⬆️ 0.77% increase vs. 7154bd0
  • Glob-2 ns/op: 158.9 ⬇️ 18.94% decrease vs. 7154bd0
  • TablesWithChildrenDefaultConcurrency-2 resources/s: 29,232 ⬇️ 0.44% decrease vs. 7154bd0
  • BufferedScanner-2 ns/op: 9.379 ⬇️ 14.83% decrease vs. 7154bd0
  • LogReader-2 ns/op: 30.69 ⬇️ 15.28% decrease vs. 7154bd0

@yevgenypats yevgenypats changed the title Fix/empty json fix: Validate json strings and handle empty strings Dec 13, 2022
@github-actions github-actions bot added the fix label Dec 13, 2022
@kodiakhq kodiakhq bot merged commit dd5f008 into main Dec 13, 2022
@kodiakhq kodiakhq bot deleted the fix/empty_json branch December 13, 2022 22:07
kodiakhq bot pushed a commit that referenced this pull request Dec 14, 2022
🤖 I have created a release *beep* *boop*
---


## [1.12.3](v1.12.2...v1.12.3) (2022-12-14)


### Bug Fixes

* Throw error on empty env variable ([#499](#499)) ([4b77cf5](4b77cf5))
* Validate json strings and handle empty strings ([#497](#497)) ([dd5f008](dd5f008))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants