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: Add jsonStrings configuration #2642

Merged
merged 5 commits into from
May 30, 2024

Conversation

rubenmorim
Copy link
Contributor

Added configuration to support jsonStrings.
Check #1072 for more details about this feat

Copy link

@wlarch wlarch left a comment

Choose a reason for hiding this comment

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

Seems perfectly legit to me. 💪

@wellwelwel wellwelwel linked an issue May 2, 2024 that may be closed by this pull request
Copy link

codecov bot commented May 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.32%. Comparing base (e536b41) to head (fac1a87).
Report is 8 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2642   +/-   ##
=======================================
  Coverage   90.32%   90.32%           
=======================================
  Files          71       71           
  Lines       15727    15729    +2     
  Branches     1339     1342    +3     
=======================================
+ Hits        14206    14208    +2     
  Misses       1521     1521           
Flag Coverage Δ
compression-0 90.32% <100.00%> (+<0.01%) ⬆️
compression-1 90.32% <100.00%> (+<0.01%) ⬆️
tls-0 89.85% <100.00%> (+<0.01%) ⬆️
tls-1 90.15% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@wellwelwel
Copy link
Collaborator

wellwelwel commented May 2, 2024

Hey, @rubenmorim. Thanks 🚀


I believe the changes also fit the binary parser:

return 'JSON.parse(packet.readLengthCodedString("utf8"));';


For typings, we can include the option jsonStrings to node-mysql2/typings/mysql/lib/Connection.d.ts:

{
  jsonStrings?: boolean;
}

Also, we could have a basic test for execute and query. What do you think? 🙋🏻‍♂️
For example, something like:

SELECT CAST('{"test": true}' AS JSON) AS json_result;

@sidorares
Copy link
Owner

lgtm, in addition to @wellwelwel comments - maybe also add a bit of documentation somewhere in https://github.com/sidorares/node-mysql2/tree/master/website/docs/documentation

@wellwelwel wellwelwel removed needs documentation needs typings Typings for new features labels May 6, 2024
@wellwelwel
Copy link
Collaborator

wellwelwel commented May 13, 2024

The added documentation also closes:

@wellwelwel
Copy link
Collaborator

wellwelwel commented May 30, 2024

Thanks again, @rubenmorim. I'll include the tests in a separate PR (#2720).

@wellwelwel wellwelwel merged commit 9820fe5 into sidorares:master May 30, 2024
65 checks passed
@rubenmorim
Copy link
Contributor Author

Thanks again, @rubenmorim. I'll include the tests in a separate PR (#2720).

Great ! thank you guys @sidorares @wellwelwel

Vylpes pushed a commit to Vylpes/Droplet that referenced this pull request Jun 3, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [mysql2](https://sidorares.github.io/node-mysql2/docs) ([source](https://github.com/sidorares/node-mysql2)) | dependencies | minor | [`3.9.8` -> `3.10.0`](https://renovatebot.com/diffs/npm/mysql2/3.9.8/3.10.0) |

---

### Release Notes

<details>
<summary>sidorares/node-mysql2 (mysql2)</summary>

### [`v3.10.0`](https://github.com/sidorares/node-mysql2/blob/HEAD/Changelog.md#3100-2024-05-30)

[Compare Source](sidorares/node-mysql2@v3.9.9...v3.10.0)

##### Features

-   add jsonStrings option ([#&#8203;2642](sidorares/node-mysql2#2642)) ([9820fe5](sidorares/node-mysql2@9820fe5))

##### Bug Fixes

-   **stream:** reads should emit the dataset number for each dataset ([#&#8203;2628](sidorares/node-mysql2#2628)) ([4dab4ca](sidorares/node-mysql2@4dab4ca))

### [`v3.9.9`](https://github.com/sidorares/node-mysql2/blob/HEAD/Changelog.md#399-2024-05-29)

[Compare Source](sidorares/node-mysql2@v3.9.8...v3.9.9)

##### Bug Fixes

-   **connection config:** remove keepAliveInitialDelay default value ([#&#8203;2712](sidorares/node-mysql2#2712)) ([688ebab](sidorares/node-mysql2@688ebab))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://git.vylpes.xyz/RabbitLabs/Droplet/pulls/314
Co-authored-by: Renovate Bot <[email protected]>
Co-committed-by: Renovate Bot <[email protected]>
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.

Provide an option to disable JSON parsing
4 participants