scontext

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyTraceID = "traceID"
	ContextKeyControl = "Control"

	ContextKeyHead        = "Head"
	ContextKeyHeadUid     = "uid"
	ContextKeyHeadSource  = "source"
	ContextKeyHeadIp      = "ip"
	ContextKeyHeadRegion  = "region"
	ContextKeyHeadDt      = "dt"
	ContextKeyHeadUnionId = "unionid"
)

由于请求的上下文信息的 thrift 定义在 util 项目中,本模块主要为了避免循环依赖

Variables

This section is empty.

Functions

func GetDt

func GetDt(ctx context.Context) (dt int32, ok bool)

func GetGroup added in v1.2.0

func GetGroup(ctx context.Context) string

func GetGroupWithDefault added in v1.3.0

func GetGroupWithDefault(ctx context.Context, dv string) string

func GetIp

func GetIp(ctx context.Context) (ip string, ok bool)

func GetRegion

func GetRegion(ctx context.Context) (region string, ok bool)

func GetSource

func GetSource(ctx context.Context) (source int32, ok bool)

func GetUid

func GetUid(ctx context.Context) (uid int64, ok bool)

func GetUnionId

func GetUnionId(ctx context.Context) (unionId string, ok bool)

Types

type ContextController added in v1.2.0

type ContextController interface {
	GetGroup() string
}

type ContextHeader

type ContextHeader interface {
	ToKV() map[string]interface{}
}

Jump to

Keyboard shortcuts

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