-
Notifications
You must be signed in to change notification settings - Fork 68
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
Feature: context.Context Support #100
Comments
@VoyTechnology I just wanted to ask a question.Currently the demand of this issue is just to make the existing functions support context or should we have to change functions so that every functions just needs the context parameter and all the data to be used in the function body will be extracted from the context body itself? |
@partik03 I am not sure I fully understand your question so I will try and answer based on my interpretation: We would pass in a new |
@VoyTechnology got it.Thanks! |
@VoyTechnology can I take up this one? |
@VoyTechnology As the project uses gorilla for making websocket connections and gorilla does not have a single context variable as you mentioned above so should I use the standard http request and response variables or should I include a library like gofiber which takes care of the context in a single variable? |
Hey @VoyTechnology @partik03 ! We do intend to standardise the interface, which would include the addition of context.Context. If you @partik03 or someone else would like to add it to the existing API then we would definitely merge that. But just giving a heads up that it is likely to change in the future. |
Is your feature request related to a problem?
This would be a part of a wider change to allow trace information propagation (if possible). Passing in the context is currently not possible and we would need it to propagate the trace information. Seeing how the Surreal server already supports tracing, this would provide a very good method of troubleshooting entire requests.
Describe the solution
The standard way to do so is by using
context.Context
and passing it as the first argument to the function. eg.This would be the preferred way as the SDK has not yet reached v1.0 so it's easier to change the method signature without a v2 release.
Alternative methods
If the method signatures are not to be changed, the
Context
suffix can be added to each method. This is rather verbose to type and is typically used when a pre-existing API is adding context support.eg.
There is no other obvious way to add context information.
SurrealDB version
N/A
Contact Details
No response
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: