Documentation ¶
Overview ¶
Package ctxkit 操作请求 ctx 信息
Index ¶
- Constants
- func GetAccessKey(ctx context.Context) string
- func GetBuild(ctx context.Context) string
- func GetBuvid(ctx context.Context) string
- func GetCompanyAppKey(ctx context.Context) string
- func GetCookie(ctx context.Context) string
- func GetDevice(ctx context.Context) string
- func GetHttpRefer(ctx context.Context) string
- func GetHttpReq(ctx context.Context) *http.Request
- func GetHttpResp(ctx context.Context) http.ResponseWriter
- func GetManageUser(ctx context.Context) string
- func GetMobiApp(ctx context.Context) string
- func GetPlatform(ctx context.Context) string
- func GetProject(ctx context.Context) string
- func GetProjectDBName(ctx context.Context) string
- func GetQQAppId(ctx context.Context) string
- func GetSign(ctx context.Context) (appkey, ts, sign string)
- func GetTokenPlatformId(ctx context.Context) int32
- func GetTraceID(ctx context.Context) string
- func GetUserAgent(ctx context.Context) string
- func GetUserID(ctx context.Context) int64
- func GetUserIP(ctx context.Context) string
- func GetUserPort(ctx context.Context) string
- func GetUserToken(ctx context.Context) string
- func GetVersion(ctx context.Context) string
- func GetWXAppId(ctx context.Context) string
- func GetWxOpenId(ctx context.Context) string
- func GetWxSessionKey(ctx context.Context) string
- func IsIOSPlatform(ctx context.Context) bool
- func IsValidSignKey(ctx context.Context) bool
- func IsWxPhoneBind(ctx context.Context) bool
- func WithDevice(ctx context.Context, device string) context.Context
- func WithHttpRefer(ctx context.Context, refer string) context.Context
- func WithHttpReq(ctx context.Context, req *http.Request) context.Context
- func WithHttpResp(ctx context.Context, resp http.ResponseWriter) context.Context
- func WithMPPlatformId(ctx context.Context, pid int32) context.Context
- func WithMobiApp(ctx context.Context, os string) context.Context
- func WithPlatform(ctx context.Context, platform string) context.Context
- func WithProject(ctx context.Context, project string) context.Context
- func WithProjectDBNameKey(ctx context.Context, name string) context.Context
- func WithQQAppId(ctx context.Context, appid string) context.Context
- func WithTraceID(ctx context.Context, traceID string) context.Context
- func WithUserAgent(ctx context.Context, ua string) context.Context
- func WithUserID(ctx context.Context, uid int64) context.Context
- func WithUserIP(ctx context.Context, ip string) context.Context
- func WithUserToken(ctx context.Context, token string) context.Context
- func WithVersion(ctx context.Context, version string) context.Context
- func WithWXAppId(ctx context.Context, appid string) context.Context
- func WithWxOpenId(ctx context.Context, openid string) context.Context
- func WithWxPhoneBind(ctx context.Context, bind int) context.Context
- func WithWxSessionKey(ctx context.Context, sessionKey string) context.Context
Constants ¶
View Source
const ( // TraceIDKey 请求唯一标识,类型:string TraceIDKey key = iota // StartTimeKey 请求开始时间,类型:time.Time StartTimeKey // UserTokenKey 用户登陆身份,未登录则为 "",类型:string UserTokenKey // UserIDKey 用户 ID,未登录则为 0,类型:int64 UserIDKey // UserIPKey 用户 IP,类型:string UserIPKey // PlatformKey 用户使用平台,ios, android, pc PlatformKey // ProjectKey ProjectKey // ProjectDBKey ProjectDBNameKey // BuildKey 客户端构建版本号 BuildKey // VersionKey 客户端版本号 VersionKey // AccessKeyKey 移动端支付令牌 AccessKeyKey // DeviceKey 移动 app 设备标识,android, phone, pad DeviceKey // MobiAppKey 移动 app 标识,android, phone, pad MobiAppKey // UserPortKey 用户端口 UserPortKey // ManageUserKey 管理后台用户名 ManageUserKey // BuvidKey 非登录用户标识 BuvidKey // CookieKey web 用户登录令牌 CookieKey // CompanyAppKeyKey CompanyAppKeyKey // AppKeyKey 接口签名标识 AppKeyKey // TsKey 时间戳 TSKey // SignKey 签名 SignKey // IsValidSignKeyKey 签名正确则置为 true IsValidSignKeyKey // http 请求对象 HttpRawReqKey // http 请求响应对象 HttpRawRespKey // User-Agent UserAgentKey // HttpRefer HttpReferKey // WxSessionKey WxSessionKey // WxOpenIdKey WxOpenIdKey // WxPhoneBindKey WxPhoneBindKey // MpPlatformIdKey MpPlatformIdKey // WXAPPIdKey WXAPPIdKey // QQAPPIdKey QQAPPIdKey )
Variables ¶
This section is empty.
Functions ¶
func GetHttpResp ¶
func GetHttpResp(ctx context.Context) http.ResponseWriter
GetCookie 获取 web cookie
func GetQQAppId ¶
func GetTokenPlatformId ¶
GetUserToken 获取用户 token
func GetWXAppId ¶
func GetWxSessionKey ¶
GetWxSession 获取用户 session key
func WithHttpReq ¶
WithHttpReq 注入 HttpRawReqKey
func WithHttpResp ¶
WithHttpResp 注入 TraceIDKey
func WithProjectDBNameKey ¶
func WithTraceID ¶
WithTraceID 注入 trace_id
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.