Documentation ¶
Index ¶
- Constants
- func GetBizTraceID(ctx *gin.Context) string
- func GetCurrentAuthType(ctx *gin.Context) string
- func GetCurrentUser(ctx *gin.Context) *contract.Staff
- func GetLang(ctx *gin.Context) string
- func GetStack(ctx *gin.Context) string
- func GetTraceID(ctx *gin.Context) string
- func InitBizTraceID(ctx *gin.Context)
- func InitTraceID(ctx *gin.Context)
- func NewContext(ginContext *gin.Context) xcontext.XContext
- func SetCurrentUser(ctx *gin.Context, s *contract.Staff)
- func SetStack(ctx *gin.Context, stack string)
Constants ¶
View Source
const ( // auth CtxKey_AuthTypeKey = ctxKeyPref + "AuthType" CtxKey_User = xcontext.USER_KEY CtxKey_UserID = xcontext.USERID_KEY CtxKey_UserName = xcontext.USERNAME_KEY // servelog 堆栈 CtxKey_Stack = ctxKeyPref + "Stack" // servelog 服务产生的真实错误信息 CtxKey_RealError = ctxKeyPref + "RealError" CtxKey_TraceID = xcontext.RASSE_TRACE_KEY CtxKey_ChainID = xcontext.BIZ_TRACE_KEY // Deprecated: Use CtxKey_TraceID instead. CtxKey_OldTraceID = "rasse-trace-id" CtxKey_QueryLang = "lang" // 参考规范:https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language CtxKey_HeaderLang = xhttp.LangHeaderKey CtxKey_CookieLang = xcontext.LANG_KEY CtxKey_Lang = xcontext.LANG_KEY )
Variables ¶
This section is empty.
Functions ¶
func GetBizTraceID ¶
func GetCurrentAuthType ¶
GetCurrentAuthType 获取当前请求采用的鉴权方法 如果禁用了鉴权组件(mw.auth.enabled=false),则总是返回空字符串 如果是某个路径关闭了鉴权功能(mode: "off"),返回"off"
func GetTraceID ¶
func InitBizTraceID ¶
func InitTraceID ¶
func SetCurrentUser ¶
SetCurrentUser 将指定用户信息保存到请求上下文
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.