[#6824] Handle context in Scan() without breaking external library compatibility #7178
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
issue: #6824
What did this pull request do?
I initially thought that adding context as an argument to the Scan() method would solve the issue, but it causes compile errors because external libraries do not expect Scan to accept context.
I’m wondering if it’s the right approach to modify Scan to directly accept context, or if there’s a better way to handle this issue without changing the method signature.
User Case Description
I’m a bit concerned about how I’m approaching this. Specifically, I’m wondering if adding context.Context internally in the Scan method is the right move. Since external libraries like sqlite might be using this method, I’m not sure if this could cause issues.
Questions:
Is it okay to add context.Context handling like this, or is there a better way I should consider?
Could this change cause compatibility issues with libraries that don’t expect the context.Context?
Should I be thinking about this problem differently, especially regarding method signatures?
I’d really appreciate any guidance or feedback on this. Thanks!