接口入口函数首个参数支持custom context

This commit is contained in:
2025-04-12 21:52:07 +08:00
parent a7fed88714
commit e0d5e9c94b
4 changed files with 15 additions and 5 deletions

View File

@ -20,7 +20,7 @@ import (
)
type Context struct {
Gin *gin.Context // 继承 gin context
Context *gin.Context // 继承 gin context
Trace *trace.Runtime // trace 实例
TraceID string
RequestID string
@ -53,7 +53,7 @@ func NewContext(ginCtx *gin.Context) *Context {
return traceID
}
ctx := &Context{
Gin: ginCtx,
Context: ginCtx,
Trace: trace.NewRuntime(traceID, 1),
TraceID: traceID,
RequestID: getRequestID(ginCtx, traceID),