-
Notifications
You must be signed in to change notification settings - Fork 72
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
sql.DB Context support #258
Comments
Hello! Thanks for your interest in kallax :D Regarding the conext support, I'm not sure how is this related to kallax. Could you explain a little more about where this could be added and what usages it would have? |
Sure, It allows you to pass a context to sql.DB methods, so that you can hook into that for passing along whatever you need, be it distributed tracing information or a user token etc. For example, this library allows for sending traces to Google or for logging. https://github.com/ExpansiveWorlds/instrumentedsql/blob/master/sql_example_test.go And here is how we send traces to Zipkin, https://github.com/echo-health/opentracing-gorm/blob/master/otgorm.go So, whilst you might want to supply context with every method, another way is to have a method to attach a context and get back a copy of the store of similar. Or work much like the |
Hi, just wanted to see if you were considering supporting this. Ideally the hook interface methods would take in a context, although that would be a breaking change. Edit: That'd only be an addition. I noticed you're using squirrel underneath for query generation, which has context support. allowing context to be passed in would bring in all the advantages of contexts such as deadline support. I understand this would possibly impact both the code generation as well as reorganization of internal methods to reduce duplication. Is there any way I can help? |
Beyond tracing and user tokens, it primarily supports timeouts which propagate to sql.DB. This means if you set a time limit on your request and it isn't going to make it, sql.DB will honor that and cancel the query so as to not waste anymore postgres resources on a query you don't want anymore. |
Sure, I'm looking for this feature too. |
Any ETA on this??? Go's Context released for a long time (a year ago), support |
Hello, thanks for your interest. For now, not in the near future, as I don't currently have the time need to implement and test new features. Pull requests are welcome though. |
👍 , I need some help to know the architecture of this project. For a quick look, we will change |
Changes would need to be non-breaking. Probably something like we have for running with proxies: A |
Thanks for the suggestion, // Store is a structure capable of retrieving records from a concrete table in
// the database.
type Store struct {
db squirrel.DBProxyContext
runner squirrel.DBProxyContext
useCacher bool
logger LoggerFunc
} |
Hi there,
Love the idea behind Kallax and I'm happy to start contributing, I'm opening an issue first to discuss and can then PR if need be!
I'm wondering if there is/have been plans for Go's new sql.DB Context support?
golang/go#15123
I rely on this heavily for distributed tracing
The text was updated successfully, but these errors were encountered: