Documentation ¶
Index ¶
- func HTTPResponse(req *restful.Request, rsp *restful.Response, code uint32)
- func InitProtoCache(option map[string]interface{}, cacheTypes []string, ...)
- func ParseJsonBody(req *restful.Request, value interface{}) error
- func ParseQueryParams(req *restful.Request) map[string]string
- type Cache
- type CacheObject
- type Handler
- func (h *Handler) Parse(message proto.Message) (context.Context, error)
- func (h *Handler) ParseArray(createMessage func() proto.Message) (context.Context, error)
- func (h *Handler) ParseArrayByText(createMessage func() proto.Message, text string) (context.Context, error)
- func (h *Handler) ParseFile() ([]*apiconfig.ConfigFile, error)
- func (h *Handler) ParseHeaderContext() context.Context
- func (h *Handler) WriteHeader(polarisCode uint32, httpStatus int)
- func (h *Handler) WriteHeaderAndProto(obj api.ResponseMessage)
- func (h *Handler) WriteHeaderAndProtoV2(obj api.ResponseMessageV2)
- type MessageToCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPResponse ¶
HTTPResponse http答复简单封装
func InitProtoCache ¶ added in v1.18.0
func InitProtoCache(option map[string]interface{}, cacheTypes []string, discoverCacheConvert MessageToCache)
func ParseJsonBody ¶
ParseJsonBody parse http body as json object
Types ¶
type Cache ¶ added in v1.18.0
type Cache interface { // Get Get(cacheType string, key string) *CacheObject // Put Put(v *CacheObject) (*CacheObject, bool) }
Cache
type CacheObject ¶ added in v1.18.0
type CacheObject struct { OriginVal proto.Message CacheType string Key string // contains filtered or unexported fields }
func (*CacheObject) GetBuf ¶ added in v1.18.0
func (c *CacheObject) GetBuf() []byte
type Handler ¶
Handler HTTP请求/回复处理器
func (*Handler) ParseArray ¶
ParseArray 解析PB数组对象
func (*Handler) ParseArrayByText ¶
func (h *Handler) ParseArrayByText(createMessage func() proto.Message, text string) (context.Context, error)
ParseArrayByText 通过字符串解析PB数组对象
func (*Handler) ParseFile ¶
func (h *Handler) ParseFile() ([]*apiconfig.ConfigFile, error)
ParseFile 解析上传的配置文件
func (*Handler) ParseHeaderContext ¶
ParseHeaderContext 将http请求header中携带的用户信息提取出来
func (*Handler) WriteHeader ¶
WriteHeader 仅返回Code
func (*Handler) WriteHeaderAndProto ¶
func (h *Handler) WriteHeaderAndProto(obj api.ResponseMessage)
WriteHeaderAndProto 返回Code和Proto
func (*Handler) WriteHeaderAndProtoV2 ¶
func (h *Handler) WriteHeaderAndProtoV2(obj api.ResponseMessageV2)
WriteHeaderAndProtoV2 返回Code和Proto
type MessageToCache ¶ added in v1.18.0
type MessageToCache func(m interface{}) *CacheObject
MessageToCache
Click to show internal directories.
Click to hide internal directories.