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

Make Postgres Encodable public #248

Merged
merged 2 commits into from
Mar 11, 2022

Conversation

fabianfett
Copy link
Collaborator

Motivation

To finally land async/await support we still need PostgresEncodable to be public

Changes

  • make properties on PostgresEncodable static again
    • make var psqlType: PostgresDataType static
    • make var psqlFormat: PostgresFormat static
    • The reason for this change is fairly simple: We needed the behavior on an instance of an object to allow PostgresData to be PostgresEncodable. However we encode PostgresData directly into PostgresBindings today. For this reason we can make the properties static again.
    • the properties are still prefixed psql... Sadly we can't use postgres here as this would collide with the PostgresDataConvertible protocol
  • Rename protocol PostgresArrayElement to PostgresArrayEncodable
  • Make PostgresEncodable and PostgresArrayEncodable public

Result

One final PR is needed to make async queries public.

@fabianfett fabianfett requested a review from gwynne March 8, 2022 22:24
@fabianfett fabianfett force-pushed the ff-make-PostgresEncodable-public branch from 9375a1a to 24b750f Compare March 8, 2022 22:25
@codecov-commenter
Copy link

Codecov Report

Merging #248 (9375a1a) into main (136cf4c) will increase coverage by 4.04%.
The diff coverage is 71.87%.

❗ Current head 9375a1a differs from pull request most recent head 24b750f. Consider uploading reports for the commit 24b750f to get more accurate results

@@            Coverage Diff             @@
##             main     #248      +/-   ##
==========================================
+ Coverage   39.72%   43.77%   +4.04%     
==========================================
  Files         115      115              
  Lines        9505     9506       +1     
==========================================
+ Hits         3776     4161     +385     
+ Misses       5729     5345     -384     
Flag Coverage Δ
unittests 43.77% <71.87%> (+4.04%) ⬆️

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

Impacted Files Coverage Δ
...s/PostgresNIO/New/Extensions/ByteBuffer+PSQL.swift 100.00% <ø> (ø)
Sources/PostgresNIO/New/PostgresCodable.swift 91.66% <ø> (ø)
...s/PostgresNIO/New/Data/Bytes+PostgresCodable.swift 64.70% <33.33%> (-8.83%) ⬇️
...es/PostgresNIO/New/Data/Date+PostgresCodable.swift 89.28% <50.00%> (ø)
...PostgresNIO/New/Data/Decimal+PostgresCodable.swift 74.19% <50.00%> (+6.45%) ⬆️
...s/PostgresNIO/New/Data/Float+PostgresCodable.swift 76.66% <50.00%> (+3.33%) ⬆️
...IO/New/Data/RawRepresentable+PostgresCodable.swift 82.35% <50.00%> (ø)
...ces/PostgresNIO/New/Data/Int+PostgresCodable.swift 36.60% <64.70%> (+11.11%) ⬆️
...s/PostgresNIO/New/Data/Array+PostgresCodable.swift 93.25% <90.00%> (-0.43%) ⬇️
...es/PostgresNIO/New/Data/Bool+PostgresCodable.swift 95.34% <100.00%> (+4.65%) ⬆️
... and 35 more

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.

Love it!

@fabianfett fabianfett merged commit 3d6666d into vapor:main Mar 11, 2022
@fabianfett fabianfett deleted the ff-make-PostgresEncodable-public branch March 11, 2022 08:05
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