Documentation
¶
Index ¶
- Constants
- func AddSqlCount(ctx context.Context)
- func Admin(ctx *gin.Context)
- func Api(h func(ctx *gin.Context) (any, error)) gin.HandlerFunc
- func GenTraceID() string
- func GetContext(c *gin.Context) context.Context
- func GetRender(ctx *gin.Context) types.ReloadableRender
- func GetSqlCount(ctx *gin.Context) int64
- func GetUser(ctx *gin.Context) *dto.UserInfo
- func I18n(c *gin.Context)
- func InitI18n(defaultLangFs embed.FS)
- func Install(ctx *gin.Context)
- func LoginInfo(ctx *gin.Context)
- func Render(tpl string, datas ...gin.H) gin.HandlerFunc
- func Response(result any, err error) gin.H
- func SetContext(c *gin.Context, ctx context.Context)
- func SetRender(views embed.FS) gin.HandlerFunc
- func SetUserInfo(ctx *gin.Context, loginInfo *dto.LoginInfo)
- func Trace(c *gin.Context)
- func WithI18n(ctx context.Context, data gin.H) gin.H
Constants ¶
View Source
const ( KeyUser = "user" KeyReqStart = "reqStart" KeyTrace = "trace" KeyLang = "lang" KeySqlCount = "sqlCount" KeyRender = "render" KeyCtx = "ctx" KeyIsDebug = "isDebug" KeyServiceCost = "serviceCost" KeyTplStart = "tplStart" KeyTplParseCost = "tplParseCost" KeyTplRenderCost = "tplRenderCost" KeyTotalCost = "totalCost" KeyErr = "err" HeaderTrace = "X-Trace-ID" )
View Source
const LoginCookieName = "login"
View Source
const UserKey = "currentUser"
Variables ¶
This section is empty.
Functions ¶
func GetRender ¶
func GetRender(ctx *gin.Context) types.ReloadableRender
GetRender 从上下文中拿出 Render (SetRender 时注入的)
func GetSqlCount ¶
func SetUserInfo ¶
SetUserInfo 登录成功时将登录信息设置到缓存和 cookie 中
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.