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

Create Tx and Conn interfaces to allow prepared statements to be used in transactions #40

Merged
merged 10 commits into from
Sep 20, 2023

Conversation

RangelReale
Copy link
Contributor

@RangelReale RangelReale commented Jun 21, 2023

sql.DB allows creating a Statement using DB.Prepare, and later this prepared statement can be used inside a transaction using tx.Stmt(). For this to work, both the statement and the transaction must be using the same underlining *sql.DB.

This library returns a raw *sql.Tx for transactions, but a custom Stmt for Prepare, which can't be used with tx.Stmt().

This MR creates Tx and Conn interfaces matching database/sql, and makes sure that transactions and statements works the same as the default ones.

bxcodec
bxcodec previously approved these changes Jul 24, 2023
Copy link
Owner

@bxcodec bxcodec left a comment

Choose a reason for hiding this comment

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

LGTM

@RangelReale can u help to test it first from master after merged?

@bxcodec
Copy link
Owner

bxcodec commented Jul 24, 2023

Let's wait for the CI-test result before merging

Copy link
Owner

@bxcodec bxcodec left a comment

Choose a reason for hiding this comment

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

LGTM

@bxcodec bxcodec merged commit 1f99231 into bxcodec:main Sep 20, 2023
21 checks passed
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.

None yet

2 participants