sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

Add NamedQueryContext to Tx

Open daveworth opened this issue 3 years ago • 7 comments

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 .

daveworth avatar Apr 14 '21 16:04 daveworth

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

coveralls avatar Apr 14 '21 17:04 coveralls

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.

daveworth avatar Apr 15 '21 19:04 daveworth

Fixes #447.

walles avatar Dec 22 '21 10:12 walles

@jmoiron please add this

s-mang avatar Dec 20 '22 19:12 s-mang

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

BLuchterhand avatar Jan 29 '24 16:01 BLuchterhand

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.

ardan-bkennedy avatar Jan 29 '24 20:01 ardan-bkennedy

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

slzhffktm avatar Jun 08 '24 04:06 slzhffktm