Skip to content

Go: support context.Context #3709

@marcind

Description

@marcind

Describe the feature

All methods that cause network resources to be consumed should accept a context.Context to align with best practices for developing go applications.

Use Case

context.Context enables cooperative cancellation scoped metadata passing, which enables tracing integrations etc. Practically all go APIs and libraries that consume non-trivial resources (such as causing networking against a remote server) take a context as a parameter.

Proposed Solution

Add a context.Context as the first parameter to all *Command methods as well as others such as Transaction.Exec. Even if not fully used now, doing it now will avoid having to add a separate set of methods that accept it or releasing a v2 with a breaking change in the interface.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Client version used

pre-release

Environment details (OS name and version, etc.)

All

Metadata

Metadata

Labels

Feature ✨Additional feature, big or smallIntegrationIssues involve integration with other software and tools.User issue 🚨Issue opened by a usergo 🏃golang wrapper

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions