aditya.siregar 3c80b710af Update Infra
2025-03-04 20:36:17 +07:00

22 lines
371 B
Go

package request
import (
"enaklo-pos-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
}