mirror of
https://github.com/PengZhangs2017582/novel.git
synced 2025-06-24 11:11:30 +08:00
43 lines
1.2 KiB
Go
43 lines
1.2 KiB
Go
// ================================================================================
|
||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||
// You can delete these comments if you wish manually maintain this interface file.
|
||
// ================================================================================
|
||
|
||
package service
|
||
|
||
import (
|
||
"context"
|
||
"novel/internal/model"
|
||
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
"github.com/gogf/gf/v2/net/ghttp"
|
||
)
|
||
|
||
type (
|
||
IBizCtx interface {
|
||
// Init 初始化上下文对象指针到上下文对象中,以便后续的请求流程中可以修改。
|
||
Init(r *ghttp.Request, customCtx *model.Context)
|
||
// Get 获得上下文变量,如果没有设置,那么返回nil
|
||
Get(ctx context.Context) *model.Context
|
||
// SetUser 将上下文信息设置到上下文请求中,注意是完整覆盖
|
||
SetUser(ctx context.Context, ctxUser *model.ContextUser)
|
||
// SetData 将上下文信息设置到上下文请求中,注意是完整覆盖
|
||
SetData(ctx context.Context, data g.Map)
|
||
}
|
||
)
|
||
|
||
var (
|
||
localBizCtx IBizCtx
|
||
)
|
||
|
||
func BizCtx() IBizCtx {
|
||
if localBizCtx == nil {
|
||
panic("implement not found for interface IBizCtx, forgot register?")
|
||
}
|
||
return localBizCtx
|
||
}
|
||
|
||
func RegisterBizCtx(i IBizCtx) {
|
||
localBizCtx = i
|
||
}
|