Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Updated to use new PostgresKit/PostgresNIO APIs #207

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
gwynne merged 10 commits into main from update-for-new-pnio
May 9, 2023
Merged

Conversation

Copy link
Member

@gwynne gwynne commented May 7, 2023
edited
Loading

PostgresKit 2.11.0 heavily revamped PostgresKit to take full (or near to it) advantage of the modern PostgresNIO APIs. These changes do the same for FluentPostgresDriver, including adopting the revisions made to PostgresKit's API. This incidentally results in a significant improvement in the layering of the three packages, with FluentPostgresDriver now relying almost entirely on PostgresKit alone rather than needing to separately know details of PostgresNIO (with one or two exceptions). The end result is much cleaner code and moderate performance improvements.

Swift 5.7 or later is now required.

Users who previously specified custom PostgresDataEncoder and/or PostgresDataDecoder instances in their database configurations will begin receiving deprecation warnings; the replacements are PostgresNIO's PostgresEncodingContext and PostgresDecodingContext:

let postgresEncoder = PostgresDataEncoder(json: JSONEncoder()) // deprecated
let postgresEncodingContext = PostgresEncodingContext(jsonEncoder: JSONEncoder()) // new
let defaultPostgresEncoder = PostgresDataEncoder() // deprecated
let defaultPostgresEncodingContext = PostgresEncodingContext.default // new
let postgresDecoder = PostgresDataDecoder(json: JSONDecoder()) // deprecated
let postgresDecodingContext = PostgresDecodingContext(jsonDecoder: JSONDecoder()) // new
let defaultPostgresDecoder = PostgresDataDecoder() // deprecated
let defaultPostgresDecodingContext = PostgresDecodingContext.default // new

gwynne added 4 commits May 6, 2023 22:16
...d FluentPostgresDatabase to use SQLDatabase for (almost) everything instead of duplicating PostgresKit's work. Ditch uses of old APIs.
@gwynne gwynne added the semver-minor Contains new APIs label May 7, 2023
@gwynne gwynne requested a review from 0xTim May 7, 2023 03:24
Copy link

codecov-commenter commented May 7, 2023
edited
Loading

Codecov Report

Merging #207 (4d4f085) into main (c7e3976) will decrease coverage by 14.17%.
The diff coverage is 43.37%.

Additional details and impacted files
@@ Coverage Diff @@
## main #207 +/- ##
===========================================
- Coverage 76.55% 62.39% -14.17% 
===========================================
 Files 7 8 +1 
 Lines 354 343 -11 
===========================================
- Hits 271 214 -57 
- Misses 83 129 +46 
Impacted Files Coverage Δ
...s/FluentPostgresDriver/DatabaseID+PostgreSQL.swift 0.00% <0.00%> (ø)
...tions/FluentPostgresConfiguration+Deprecated.swift 0.00% <0.00%> (ø)
...uentPostgresDriver/PostgresConverterDelegate.swift 72.54% <66.66%> (ø)
...ntPostgresDriver/FluentPostgresConfiguration.swift 60.97% <68.42%> (+16.71%) ⬆️
.../FluentPostgresDriver/FluentPostgresDatabase.swift 84.81% <78.18%> (-7.01%) ⬇️
...es/FluentPostgresDriver/PostgresRow+Database.swift 85.71% <85.71%> (-4.03%) ⬇️
...es/FluentPostgresDriver/FluentPostgresDriver.swift 100.00% <100.00%> (+15.38%) ⬆️

... and 1 file with indirect coverage changes

Copy link
Member

@0xTim 0xTim left a comment

Choose a reason for hiding this comment

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

Query around the needing to change the migrations, if that's all good then we're good to go

default: break
}
let (sql, binds) = self.serialize(expression)
self.logger.log(level: self.sqlLogLevel, "\(sql) \(binds)")
Copy link
Member

Choose a reason for hiding this comment

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

For reference for anyone else reviewing - this is now handled in PostgresKit

@gwynne gwynne merged commit 8817a61 into main May 9, 2023
@gwynne gwynne deleted the update-for-new-pnio branch May 9, 2023 16:01
Copy link

VaporBot commented May 9, 2023

These changes are now available in 2.7.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@0xTim 0xTim 0xTim approved these changes

Assignees
No one assigned
Labels
semver-minor Contains new APIs
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /