Skip to content
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

feat(transaction): Adding withTransaction #519

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

thoven87
Copy link

First pass at feature #512

What's the best way to go about writing unit test for the withTransaction func?

Copy link
Collaborator

@fabianfett fabianfett left a comment

Choose a reason for hiding this comment

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

Added some more comments.

Tests/IntegrationTests/PostgresClientTests.swift Outdated Show resolved Hide resolved
Comment on lines 102 to 109
let _ = try await client.withTransaction(logger: logger) { transaction in
try await transaction.query(
"""
INSERT INTO "\(unescaped: tableName)" (uuid) VALUES (\(iterations));
""",
logger: logger
)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't check the error here at all. There is also nothing here to rollback.

Copy link
Author

Choose a reason for hiding this comment

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

Tests have been updated. I apologize about skipping this part.

@thoven87 thoven87 requested a review from fabianfett December 16, 2024 04:49
@MahdiBM MahdiBM linked an issue Jan 30, 2025 that may be closed by this pull request
Copy link

codecov bot commented Jan 31, 2025

Codecov Report

Attention: Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.

Project coverage is 61.68%. Comparing base (d6b6487) to head (e8283da).

Files with missing lines Patch % Lines
Sources/PostgresNIO/Pool/PostgresClient.swift 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #519      +/-   ##
==========================================
- Coverage   61.75%   61.68%   -0.07%     
==========================================
  Files         125      125              
  Lines       10089    10099      +10     
==========================================
  Hits         6230     6230              
- Misses       3859     3869      +10     
Files with missing lines Coverage Δ
Sources/PostgresNIO/Pool/PostgresClient.swift 0.00% <0.00%> (ø)

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.

Is transaction supporte?
3 participants