postgres-nio
postgres-nio copied to clipboard
Implement Basic `SimpleQuery` Handling
Resolves #499
Checklist
- [x] Implement basic SimpleQuery handling.
- [x] Tests.
- [x] Fix decoding rows from a
SimpleQueryresponse withtextformat.
~~Decoding rows from a simple-query response seems to fail for now, although no-row queries do succeed. I think because as described in Postgres docs, the returned format of data for simple-query is text, and PostgresNIO doesn't properly support that.~~
EDIT: For SimpleQuery only, I removed the line that forced formats to be binary, and things are working now. I'm not sure how well PostgresNIO supports the text format, but it works for strings and ints.
Not Implemented In This PR
- [ ] Multiple statements in a single
SimpleQuery.
Codecov Report
Attention: Patch coverage is 82.83019% with 91 lines in your changes missing coverage. Please review.
Project coverage is 63.05%. Comparing base (
ecbc3eb) to head (942a3cb).
Additional details and impacted files
@@ Coverage Diff @@
## main #505 +/- ##
==========================================
+ Coverage 62.16% 63.05% +0.88%
==========================================
Files 130 131 +1
Lines 10422 10919 +497
==========================================
+ Hits 6479 6885 +406
- Misses 3943 4034 +91
| Files with missing lines | Coverage Ξ | |
|---|---|---|
| ...es/PostgresNIO/Connection/PostgresConnection.swift | 41.04% <100.00%> (+2.60%) |
:arrow_up: |
| Sources/PostgresNIO/New/PSQLTask.swift | 81.39% <100.00%> (+3.61%) |
:arrow_up: |
| ...urces/PostgresNIO/New/PostgresChannelHandler.swift | 84.70% <100.00%> (+0.19%) |
:arrow_up: |
| ...stgresNIO/New/PostgresFrontendMessageEncoder.swift | 100.00% <100.00%> (ΓΈ) |
|
| ...nection State Machine/ConnectionStateMachine.swift | 66.69% <83.07%> (+2.42%) |
:arrow_up: |
| ...ection State Machine/SimpleQueryStateMachine.swift | 80.27% <80.27%> (ΓΈ) |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
I wonder if a better way is to build a dedicated SimpleQueryStateMachine? Wdyt?
@fabianfett i moved the stuff to that, mid-PR.
There is a SimpleQueryStateMachine file, though in GitHub UI you might need to chase it and push that "Load diff" button.
FWIW we're already using this function on prod and it's been working as it should. Of course we're not querying rows with multiple queries because that's not implemented. The tests should also be pretty good π.