Skip to content

New PostgresConnection connect API #245

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 3 commits into from
Mar 8, 2022

Conversation

fabianfett
Copy link
Collaborator

@fabianfett fabianfett commented Mar 6, 2022

Motivation

Our current connection creation API is very weird. Adopters first need to connect to a server and then manually call authenticate on the just created connection to auth and select the database.

Changes

  • Add new connect method that allows users to connect and auth with a single call
  • Add new connect async/await API

Result

Easier to use public interface

Open questions:

  • Parameter order in new connect method.
  • Splitting up PostgresConnection.Configuration into three subtypes.

@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2022

Codecov Report

Merging #245 (8a1abf4) into main (3212037) will increase coverage by 4.13%.
The diff coverage is 48.83%.

@@            Coverage Diff             @@
##             main     #245      +/-   ##
==========================================
+ Coverage   39.57%   43.70%   +4.13%     
==========================================
  Files         115      115              
  Lines        9479     9504      +25     
==========================================
+ Hits         3751     4154     +403     
+ Misses       5728     5350     -378     
Flag Coverage Δ
unittests 43.70% <48.83%> (+4.13%) ⬆️

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

Impacted Files Coverage Δ
...es/PostgresNIO/Connection/PostgresConnection.swift 15.42% <46.34%> (+4.33%) ⬆️
Sources/PostgresNIO/New/PSQLChannelHandler.swift 61.83% <100.00%> (+10.66%) ⬆️
...ces/PostgresNIO/New/PostgresRow-multi-decode.swift 4.44% <0.00%> (+0.19%) ⬆️
Sources/PostgresNIO/Data/PostgresRow.swift 50.00% <0.00%> (+1.02%) ⬆️
...s/PostgresNIO/New/Data/Array+PostgresCodable.swift 94.73% <0.00%> (+1.05%) ⬆️
...rces/PostgresNIO/New/Extensions/Logging+PSQL.swift 19.60% <0.00%> (+1.42%) ⬆️
...ostgresNIO/Deprecated/PostgresMessageDecoder.swift 95.45% <0.00%> (+2.27%) ⬆️
...es/PostgresNIO/New/PSQLBackendMessageDecoder.swift 93.28% <0.00%> (+2.98%) ⬆️
...urces/PostgresNIO/New/Messages/ErrorResponse.swift 32.30% <0.00%> (+3.07%) ⬆️
... and 22 more

@fabianfett fabianfett force-pushed the ff-new-connect-API branch from 9a74d6d to d68e225 Compare March 6, 2022 14:07
@fabianfett fabianfett requested a review from gwynne March 6, 2022 14:12
Copy link
Contributor

@dnadoba dnadoba left a comment

Choose a reason for hiding this comment

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

LGTM

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.

LGTM!

@fabianfett fabianfett merged commit 2998b1c into vapor:main Mar 8, 2022
@fabianfett fabianfett deleted the ff-new-connect-API branch March 8, 2022 19:20
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.

4 participants