Skip to content

Remove PSQLJSONDecoder #216

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

Merged
merged 2 commits into from
Feb 17, 2022
Merged

Conversation

fabianfett
Copy link
Collaborator

Motivation

While rewriting lot's of PostgresNIO internals in the last year, I created new types that very closely match existing types. This was a mistake. I should have tried everything to reuse existing types, and change them as needed.

Changes

⚠️ This PR extends API... minor version bump required.

  • Remove PSQLJSONDecoder
  • Extend PostgresJSONDecoder with a decode method based on ByteBuffer
  • Provide a default implementation for the new decode method based on ByteBuffer to not break API
  • Replace all uses of PSQLJSONDecoder with PostgresJSONDecoder

Result

Fewer types, easier API for adopters.

@codecov-commenter
Copy link

codecov-commenter commented Feb 15, 2022

Codecov Report

Merging #216 (e4bf026) into main (cc07811) will increase coverage by 4.14%.
The diff coverage is 25.00%.

@@            Coverage Diff             @@
##             main     #216      +/-   ##
==========================================
+ Coverage   40.44%   44.59%   +4.14%     
==========================================
  Files         116      117       +1     
  Lines        7771     7775       +4     
==========================================
+ Hits         3143     3467     +324     
+ Misses       4628     4308     -320     
Flag Coverage Δ
unittests 44.59% <25.00%> (+4.14%) ⬆️

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

Impacted Files Coverage Δ
Sources/PostgresNIO/Postgres+PSQLCompat.swift 0.00% <ø> (ø)
...es/PostgresNIO/Utilities/PostgresJSONDecoder.swift 0.00% <0.00%> (ø)
Sources/PostgresNIO/New/PSQLRow.swift 63.15% <50.00%> (+2.63%) ⬆️
Sources/PostgresNIO/New/PSQLCodable.swift 100.00% <100.00%> (ø)
...urces/PostgresNIO/New/Data/Array+PSQLCodable.swift 94.68% <0.00%> (+1.06%) ⬆️
...rces/PostgresNIO/New/Extensions/Logging+PSQL.swift 19.60% <0.00%> (+1.42%) ⬆️
Sources/PostgresNIO/New/PSQLConnection.swift 31.68% <0.00%> (+1.98%) ⬆️
...s/PostgresNIO/Message/PostgresMessageDecoder.swift 95.45% <0.00%> (+2.27%) ⬆️
Sources/PostgresNIO/New/Data/Int+PSQLCodable.swift 20.26% <0.00%> (+2.61%) ⬆️
... and 22 more

@fabianfett fabianfett requested a review from 0xTim February 15, 2022 13:19
@fabianfett fabianfett force-pushed the ff-remove-psqljsondecoder branch from 77448bb to e4bf026 Compare February 17, 2022 16:55
Copy link
Member

@gwynne gwynne left a comment

Choose a reason for hiding this comment

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

What I said on #215? That, but with more Infinity Improbability Drive side effects going on to drive home the idea that these are good PRs 😂

@fabianfett fabianfett merged commit 0b5c400 into vapor:main Feb 17, 2022
@fabianfett fabianfett deleted the ff-remove-psqljsondecoder branch February 17, 2022 18:53
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.

3 participants