Documentation
¶
Index ¶
- Constants
- func CtxGetRaw(c context.Context, key string) []byte
- func CtxGetStr(c context.Context, key string) string
- func CtxSetRaw(c *gin.Context, key string, data []byte)
- func F(ctx context.Context, format string, args ...interface{}) string
- func MakeCtx(c *gin.Context) context.Context
- func RequestUnmarshal(c *gin.Context, data IRequest) (context.Context, error)
- func ResponseMarshal(c *gin.Context, err error, data IResponse)
- type IRequest
- type IResponse
- type ReqCommon
- type ReqCommonData
- type RespCommon
- type RespCommonData
Constants ¶
View Source
const ( CtxKeyClientIP = "ctx.client.ip" CtxKeyUuid = "ctx.client.uuid" CtxKeyAppID = "ctx.client.appid" CtxKeyVersion = "ctx.client.version" CtxKeyDeviceID = "ctx.client.deviceid" CtxKeyRequestID = "ctx.client.rid" CtxKeyRequestTime = "ctx.client.rtimestamp" CtxKeyEchoToken = "ctx.client.echo_token" CtxKeyMetricName = "ctx.g.metric_name" CtxKeyRequestData = "ctx.request.data" CtxKeyResponseData = "ctx.response.data" CtxKeyResponseObject = "ctx.response.object" CtxKeySessionToken = "ctx.session.token" )
Variables ¶
This section is empty.
Functions ¶
func RequestUnmarshal ¶
RequestUnmarshal 解析入参
Types ¶
type IRequest ¶
type IRequest interface {
GetCommon() *ReqCommonData
}
IRequest the interface of request datas
type IResponse ¶
type IResponse interface {
GetCommon() *RespCommonData
}
IResponse the interface of response datas
type ReqCommon ¶
type ReqCommon struct {
Common ReqCommonData `json:"common"`
}
ReqCommon common header in a request
func (*ReqCommon) GetCommon ¶
func (r *ReqCommon) GetCommon() *ReqCommonData
type ReqCommonData ¶
type ReqCommonData struct { Uid string `json:"uid,omitempty"` AppID string `json:"appid,omitempty"` SessToken string `json:"session_token"` RequestID string `json:"request_id,omitempty"` DeviceID string `json:"device_id,omitempty"` Timestamp int64 `json:"timestamp"` EchoToken string `json:"echo_token"` }
type RespCommon ¶
type RespCommon struct {
Common RespCommonData `json:"common"`
}
RespCommon common header in a response
func (*RespCommon) GetCommon ¶
func (r *RespCommon) GetCommon() *RespCommonData
Click to show internal directories.
Click to hide internal directories.