Open samjohnduke opened 6 years ago
Also curious about this one, has it been removed for a reason?
There have been 3 attempts at PRs for this change:
https://github.com/jmoiron/sqlx/pull/348 https://github.com/jmoiron/sqlx/pull/373 https://github.com/jmoiron/sqlx/pull/448
This repository still seems to be active, with recent commits, so it's not clear what is holding this back.
Each of the above PRs lacks any unit tests, but those should be easily implemented?
I'm also interested in this.
I'm pretty sure many people who actively use the package are interested.
@jmoiron is there anything that can be\should be done for this to be part of the package?
I was creating an interface in my application so I can reuse the same code for db interaction with and without transactions and that's when I realized NamedQueryContext
is missing in sqlx.Tx
. Any particular reason why this method is missing?
Six PRs have been made for this issue that I could find right now:
https://github.com/jmoiron/sqlx/search?q=NamedQueryContext+is%3Apr&type=issues
Also, this is the second highest voted issue out of 240 open ones:
https://github.com/jmoiron/sqlx/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc
@jmoiron do you think you could do one of:
README.md
that the project won't be maintained any more and archive itEither way, you built something useful, thanks!
Just in case someone hasn't figured this out yet: it is possible to do sqlx.NamedQueryContext(ctx, tx, query, arg)
. tx
must implement sqlx.ExtContext
(allowing your caller to accept either a tx or DB connection itself.)
sqlx.NamedQueryContext(ctx, tx, query, arg)
with postgres resulted in question marks in the query instead of the postgres positional characters like $1
, $2
..
I see in the documentation it's mentioned in some places that actually these arguments become ?
indeed, so not sure if this is an incompatibility with postgres or if there is something I missed.
+1 to wanting this
@sakishrist Reading sqlx.NamedQueryContext
, it seems to choose the bind mode based on the driver name. If you are using a custom postgres driver, that may be your issue.
+1 to wanting this! This wasn't solved in the meantime right?
Hi,
I'm not a prolific contributor, but I found this method to be missing on the transaction struct. I could just use a prepare query yes, but for consistency i think i should be there. I will create a quick pull request to fix.
Sam