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

Support Context #97

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Support Context #97

wants to merge 2 commits into from

Conversation

dd-caleb
Copy link

Have you considered supporting context.Context in this package?

Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.

Context is widely used in many Go packages, so it seems worthwhile to add. In my case, context is necessary to pass trace ids for request tracing.

This PR is an initial stab at implementation. I mimic'd what was done for database/sql:

func (s *Stmt) Exec(args ...interface{}) (Result, error)
func (s *Stmt) ExecContext(ctx context.Context, args ...interface{}) (Result, error)

There is some overlap with the existing timeout option, but having both is the more conservative option and only adds new methods to the API without breaking existing functionality.

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.

1 participant