func handler(c *gin.Context) { c.Set("key", "value") // ... other code here }
func handler(c *gin.Context) { val, exists := c.Get("key") if exists { value := val.(string) // ... other code here } }In the examples above, the `c.Set` and `c.Get` methods are part of the gin-gonic/gin package. Overall, the gin-gonic/gin Context Set is a useful function for storing and retrieving data within the context of a request, and is part of the popular Gin web framework for Go.