Skip to content

Add NamedQueryContext to Tx #724

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daveworth
Copy link

This change adds the NamedQueryContext method on Transactions to match calls on the Database directly. This allows the use of DB and Tx objects more interchangeably in consuming codebases.

I totally recognize that this exact change has been proposed and many PRs with the addition have been submitted (#348 #373 #448) but they all lacked tests. This PR also includes those changes and hopefully resolves #447 .

This change adds the NamedQueryContext method on Transactions to match
calls on the Database directly.  This allows the use of `DB` and `Tx`
objects more interchangeably in consuming codebases.
@coveralls
Copy link

Pull Request Test Coverage Report for Build 226

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.6%) to 74.511%

Totals Coverage Status
Change from base Build 224: 0.6%
Covered Lines: 1219
Relevant Lines: 1636

💛 - Coveralls

@daveworth
Copy link
Author

Hi @jmoiron - I realized I submitted this without contributing to #447 - there may possibly be great reasons the other PRs I reference have not landed (not just the missing tests). If there's anything in addition I can contribute to help move this over the line I am more than happy to do so. Particularly if you have any strong contribution conditions I'd love to meet them and even write them up as a CONTRIBUTING file.

@walles
Copy link

walles commented Dec 22, 2021

Fixes #447.

@s-mang
Copy link

s-mang commented Dec 20, 2022

@jmoiron please add this

@BLuchterhand
Copy link

would love to 1-up this as this would be immensely useful for my project!

@ardan-bkennedy
Copy link
Collaborator

Hi @BLuchterhand, I and @dlsniper have taken over the repo and have some changes we want to make that might make this change unnecessary. That being said, we need to review all these issues and PRs. We have not found time to do this yet, it is something we are trying to schedule.

Some of the APIs you will find in this package I want to add to sqlx.

https://github.com/ardanlabs/service/tree/master/business/data/sqldb

Obviously logging and OTEL would need to be ripped out. I haven't been able to focus on this just yet.

@dlsniper dlsniper added the could merge The PR look safe enough to merge label Feb 1, 2024
@slzhffktm
Copy link

Hello @jmoiron may i ask if this can be merged? Really need this from years ago!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
could merge The PR look safe enough to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing NamedQueryContext on *sqlx.Tx
9 participants