22 lines
368 B
Go
22 lines
368 B
Go
package request
|
|
|
|
import (
|
|
"furtuna-be/internal/common/mycontext"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func GetMyContext(c *gin.Context) mycontext.Context {
|
|
rawCtx, exists := c.Get("myCtx")
|
|
if !exists {
|
|
// handle missing context
|
|
return mycontext.NewContext(c)
|
|
}
|
|
|
|
myCtx, ok := rawCtx.(mycontext.Context)
|
|
if !ok {
|
|
return mycontext.NewContext(c)
|
|
}
|
|
|
|
return myCtx
|
|
}
|