Closed sorushsaghari closed 3 years ago
Context in go is a communication and cancellation mechanism that can be passed across domain boundaries.
I am not a gin expert, but according to their docs:
Context is the most important part of gin. It allows us to pass variables between middleware, manage the flow, validate the JSON of a request and render a JSON response for example.
You might also find interesting to read the code itself here as it will help you understand how they use context to glue the mentioned features.
Gin wrapped many information about the http protocol inside the context, more content can be find in the official doc: https://godoc.org/github.com/gin-gonic/gin#Context For real world, we need to read the session/cookie or user information, we can read it from the context.
hello guys . i dont understand why all serializers have a *gin.Context in them like these.