vapor / postgres-nio

🐘 Non-blocking, event-driven Swift client for PostgreSQL.
https://api.vapor.codes/postgresnio/documentation/postgresnio/
MIT License
327 stars 75 forks source link

Remove need to supply PostgresDecodingContext on decode #307

Closed fabianfett closed 2 years ago

fabianfett commented 2 years ago

Motivation

To use a customized JSONDecoder, users have the option to supply a PostgresDecodingContext. Currently we require users to set explicitly on every row decode call. This makes the API unnecessarily verbose. Since the PostgresDecodingContext is generic we can not default the parameter. Instead we need add proxy functions so that we can default the parameter manually.

Changes

codecov-commenter commented 2 years ago

Codecov Report

Merging #307 (17ba80f) into main (17ba80f) will not change coverage. The diff coverage is n/a.

:exclamation: Current head 17ba80f differs from pull request most recent head a2affaf. Consider uploading reports for the commit a2affaf to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #307 +/- ## ======================================= Coverage 43.94% 43.94% ======================================= Files 115 115 Lines 9670 9670 ======================================= Hits 4249 4249 Misses 5421 5421 ``` | Flag | Coverage Δ | | |---|---|---| | unittests | `43.94% <0.00%> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#carryforward-flags-in-the-pull-request-comment) to find out more.
fabianfett commented 2 years ago

The API breakage detector reports a false positive here. The decode methods have been moved from PostgresRowSequence to extension AsyncSequence where Element == PostgresRow, which PostgresRowSequence conforms to.