Skip to content

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