init project
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user