Documentation ¶
Index ¶
- Constants
- Variables
- func Bearer(tok string) string
- func BindClientAuth(ctx Context, source token.Source) error
- func BindHead(ctx Context, option HeadOption)
- func BindServerAuth(ctx Context, source token.Source) error
- func ContentTypeTo(ct string) string
- func Get[T any](ctx Context, key string) T
- func GetApp(ctx Context) app.Info
- func GetClientIP(ctx Context) string
- func GetContentType(ctx Context) string
- func GetCustom(ctx Context) interface{}
- func GetSystem(ctx Context) app.System
- func GetTokenSource(ctx Context) token.Source
- func GetUid(ctx Context) string
- func GetUidI64(ctx Context) int64
- func HeadInt64(ctx Context, key string) int64
- func ParamInt64(ctx Context, key string) int64
- func QueryInt64(ctx Context, key string) int64
- func Send(ctx Context, result result.Result, data interface{})
- func SendException(ctx Context, req request.HeadV2)
- func SendStatusNoHead(ctx Context, httpCode int, result result.Result, data interface{})
- func SendWithHead(ctx Context, req request.HeadV2, result result.Result, data interface{})
- func SendWithStatus(ctx Context, httpCode int, req request.HeadV2, result result.Result, ...)
- func SetUid(ctx Context, uid string)
- func SetUidI64(ctx Context, uid int64)
- func WithHeadOption(ctx Context, header *Header)
- type Base
- type CacheContext
- type Context
- type HeadOption
- type Header
- type HeaderContext
- type HttpContext
- type ReqHead
- func (h *ReqHead) GetRecvAt() int64
- func (h *ReqHead) GetReqAt() int64
- func (h *ReqHead) GetSeqId() string
- func (h *ReqHead) GetSource() string
- func (h *ReqHead) GetTimeOut() time.Duration
- func (h *ReqHead) GetVersion() string
- func (h *ReqHead) SetSource(source string)
- func (h *ReqHead) SetTimeOut(duration time.Duration)
- type Request
- type ResHead
- type Response
Constants ¶
View Source
const ( KHead = "HEADER" KToken = "TOKEN" KUid = "UID" )
View Source
const ( UNK = "unk" XML = "xml" JSON = "json" PLAIN = "plain" )
View Source
const ( CSysVersion = "X-H79-SysVersion" CDeviceId = "X-H79-DeviceId" CModel = "X-H79-Model" CWifi = "X-H79-Wifi" CChannel = "X-H79-Channel" CExtInfo = "X-H79-ExtInfo" CTerminal = "terminal" CAppId = "appId" CVersion = "version" CSeqId = "seqId" CSource = "source" CTimeAt = "timeAt" CToken = "Authorization" )
Variables ¶
View Source
var DefErrorHttpCode = http.StatusOK
Functions ¶
func BindHead ¶ added in v0.5.22
func BindHead(ctx Context, option HeadOption)
func ContentTypeTo ¶ added in v0.1.2
func GetClientIP ¶
func GetContentType ¶
func GetTokenSource ¶ added in v0.5.18
func ParamInt64 ¶
func QueryInt64 ¶
func SendException ¶
func SendStatusNoHead ¶ added in v0.5.19
func SendWithHead ¶ added in v0.5.25
func SendWithStatus ¶ added in v0.4.6
func WithHeadOption ¶ added in v1.0.1
Types ¶
type CacheContext ¶ added in v0.1.4
type Context ¶ added in v0.1.2
type Context interface { HttpContext() HttpContext HeaderContext() HeaderContext CacheContext() CacheContext AuthContext() token.Engine }
type HeadOption ¶ added in v1.0.1
type Header ¶
func (*Header) HasDeviceId ¶
type HeaderContext ¶ added in v0.1.4
type HttpContext ¶ added in v0.1.4
type ReqHead ¶
type ReqHead struct { Version string `form:"version" binding:"-" json:"version"` Source string `form:"source" binding:"-" json:"source"` SeqId string `form:"seqId" binding:"-" json:"seqId"` ReqAt int64 `form:"timeAt" binding:"-" json:"timeAt"` //请求者的时间(客户端时间) RecvAt int64 `json:"-"` //收到请求时间(服务端时间) TimeOut time.Duration `json:"-"` }
func GetReqHead ¶
func (*ReqHead) GetTimeOut ¶
GetTimeOut request.HeadV2 interface
func (*ReqHead) GetVersion ¶
GetVersion request.Head interface
func (*ReqHead) SetTimeOut ¶
SetTimeOut request.HeadV2 interface
type Request ¶
func NewRequest ¶
func NewRequest() Request
type ResHead ¶
type ResHead struct { result.Result Version string `json:"version"` //版本,请求者版本 Source string `json:"source,omitempty"` //请求源,可以请求者填写 SeqId string `json:"seqId,omitempty"` //请求序号,由请求者定义,服务器原路返回 TimeAt int64 `json:"timeAt,omitempty"` //服务收到请求的时间(ms) DiffAt int64 `json:"diffAt,omitempty"` //客户端与服务端时间差值(ms) SpendAt int64 `json:"spendAt,omitempty"` //从服务收到请求到响应完成,所花的时长(ms) ServerAt int64 `json:"serverAt,omitempty"` //服务器时间,豪秒,用于检验对时(ms) LogId string `json:"logId,omitempty"` }
func NewResHead ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.