xgin

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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 GetBizTraceID(ctx *gin.Context) string

func GetCurrentAuthType

func GetCurrentAuthType(ctx *gin.Context) string

GetCurrentAuthType 获取当前请求采用的鉴权方法 如果禁用了鉴权组件(mw.auth.enabled=false),则总是返回空字符串 如果是某个路径关闭了鉴权功能(mode: "off"),返回"off"

func GetCurrentUser

func GetCurrentUser(ctx *gin.Context) *contract.Staff

GetCurrentUser 获取当前登录用户

func GetLang

func GetLang(ctx *gin.Context) string

func GetStack

func GetStack(ctx *gin.Context) string

func GetTraceID

func GetTraceID(ctx *gin.Context) string

func InitBizTraceID

func InitBizTraceID(ctx *gin.Context)

func InitTraceID

func InitTraceID(ctx *gin.Context)

func NewContext

func NewContext(ginContext *gin.Context) xcontext.XContext

构造gin的xcontext

func SetCurrentUser

func SetCurrentUser(ctx *gin.Context, s *contract.Staff)

SetCurrentUser 将指定用户信息保存到请求上下文

func SetStack

func SetStack(ctx *gin.Context, stack string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL