aditya.siregar 67f1dbc850 init project
2024-05-28 14:14:55 +07:00

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
}