支持custom context #10

Merged
zhangdeman merged 5 commits from feature/upgrade_context into master 2025-04-13 15:46:22 +08:00
Showing only changes of commit 54a8fa91c7 - Show all commits

View File

@ -87,8 +87,9 @@ func RequestHandler(uriCfg UriConfig) gin.HandlerFunc {
inputValue = inputValue.Elem()
}
var firstParam reflect.Value
if uriCfg.CtxType == define.CustomContextKey {
firstParam = reflect.ValueOf(ctx.MustGet(define.CustomContextKey))
if uriCfg.CtxType == CustomContextType {
customCtx := ctx.MustGet(define.CustomContextKey)
firstParam = reflect.ValueOf(customCtx)
} else {
firstParam = reflect.ValueOf(ctx)
}