Documentation ¶
Index ¶
- Constants
- Variables
- func GetControlCallerMethod(ctx context.Context) (method string, ok bool)
- func GetControlCallerServerId(ctx context.Context) (serverId string, ok bool)
- func GetControlCallerServerName(ctx context.Context) (serverName string, ok bool)
- func GetControlRouteGroup(ctx context.Context) (group string, ok bool)
- func GetControlRouteGroupWithDefault(ctx context.Context, dv string) string
- func GetDt(ctx context.Context) (dt int32, ok bool)
- func GetIp(ctx context.Context) (ip string, ok bool)
- func GetRegion(ctx context.Context) (region string, ok bool)
- func GetSource(ctx context.Context) (source int32, ok bool)
- func GetUid(ctx context.Context) (uid int64, ok bool)
- func GetUnionId(ctx context.Context) (unionId string, ok bool)
- func SetControlCallerMethod(ctx context.Context, method string) (context.Context, error)
- func SetControlCallerServerId(ctx context.Context, serverId string) (context.Context, error)
- func SetControlCallerServerName(ctx context.Context, serverName string) (context.Context, error)
- func SetControlRouteGroup(ctx context.Context, group string) (context.Context, error)
- type ContextControlCaller
- type ContextControlRouter
- type ContextHeader
Constants ¶
View Source
const ( ContextKeyTraceID = "traceID" ContextKeyHead = "Head" ContextKeyHeadUid = "uid" ContextKeyHeadSource = "source" ContextKeyHeadIp = "ip" ContextKeyHeadRegion = "region" ContextKeyHeadDt = "dt" ContextKeyHeadUnionId = "unionid" ContextKeyControl = "Control" )
由于请求的上下文信息的 thrift 定义在 util 项目中,本模块主要为了避免循环依赖
View Source
const DefaultGroup = ""
Variables ¶
View Source
var ErrInvalidContext = errors.New("invalid context")
Functions ¶
func GetControlCallerMethod ¶
func SetControlCallerMethod ¶
Types ¶
type ContextControlCaller ¶
type ContextControlRouter ¶
type ContextHeader ¶
type ContextHeader interface {
ToKV() map[string]interface{}
}
Click to show internal directories.
Click to hide internal directories.