vapor / fluent-postgres-driver

🐘 PostgreSQL driver for Fluent.
MIT License
146 stars 53 forks source link

Updated to use new PostgresKit/PostgresNIO APIs #207

Closed gwynne closed 1 year ago

gwynne commented 1 year ago

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
codecov-commenter commented 1 year ago

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 ```diff @@ 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](https://app.codecov.io/gh/vapor/fluent-postgres-driver/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor) | Coverage Δ | | |---|---|---| | [...s/FluentPostgresDriver/DatabaseID+PostgreSQL.swift](https://app.codecov.io/gh/vapor/fluent-postgres-driver/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9GbHVlbnRQb3N0Z3Jlc0RyaXZlci9EYXRhYmFzZUlEK1Bvc3RncmVTUUwuc3dpZnQ=) | `0.00% <0.00%> (ø)` | | | [...tions/FluentPostgresConfiguration+Deprecated.swift](https://app.codecov.io/gh/vapor/fluent-postgres-driver/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9GbHVlbnRQb3N0Z3Jlc0RyaXZlci9EZXByZWNhdGlvbnMvRmx1ZW50UG9zdGdyZXNDb25maWd1cmF0aW9uK0RlcHJlY2F0ZWQuc3dpZnQ=) | `0.00% <0.00%> (ø)` | | | [...uentPostgresDriver/PostgresConverterDelegate.swift](https://app.codecov.io/gh/vapor/fluent-postgres-driver/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9GbHVlbnRQb3N0Z3Jlc0RyaXZlci9Qb3N0Z3Jlc0NvbnZlcnRlckRlbGVnYXRlLnN3aWZ0) | `72.54% <66.66%> (ø)` | | | [...ntPostgresDriver/FluentPostgresConfiguration.swift](https://app.codecov.io/gh/vapor/fluent-postgres-driver/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9GbHVlbnRQb3N0Z3Jlc0RyaXZlci9GbHVlbnRQb3N0Z3Jlc0NvbmZpZ3VyYXRpb24uc3dpZnQ=) | `60.97% <68.42%> (+16.71%)` | :arrow_up: | | [.../FluentPostgresDriver/FluentPostgresDatabase.swift](https://app.codecov.io/gh/vapor/fluent-postgres-driver/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9GbHVlbnRQb3N0Z3Jlc0RyaXZlci9GbHVlbnRQb3N0Z3Jlc0RhdGFiYXNlLnN3aWZ0) | `84.81% <78.18%> (-7.01%)` | :arrow_down: | | [...es/FluentPostgresDriver/PostgresRow+Database.swift](https://app.codecov.io/gh/vapor/fluent-postgres-driver/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9GbHVlbnRQb3N0Z3Jlc0RyaXZlci9Qb3N0Z3Jlc1JvdytEYXRhYmFzZS5zd2lmdA==) | `85.71% <85.71%> (-4.03%)` | :arrow_down: | | [...es/FluentPostgresDriver/FluentPostgresDriver.swift](https://app.codecov.io/gh/vapor/fluent-postgres-driver/pull/207?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9GbHVlbnRQb3N0Z3Jlc0RyaXZlci9GbHVlbnRQb3N0Z3Jlc0RyaXZlci5zd2lmdA==) | `100.00% <100.00%> (+15.38%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/vapor/fluent-postgres-driver/pull/207/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor)
VaporBot commented 1 year ago

These changes are now available in 2.7.0