Documentation ¶
Index ¶
- Constants
- func ContextSetErrCode(ctx context.Context, errCode int)
- func InjectFromRequest() gin.HandlerFunc
- func Metric() gin.HandlerFunc
- func Recovery() gin.HandlerFunc
- func Trace() gin.HandlerFunc
- type Context
- type ErrCode
- type HandlerFunc
- type Head
- type HttpServer
- func (s *HttpServer) Any(relativePath string, handlers ...HandlerFunc)
- func (s *HttpServer) DELETE(relativePath string, handlers ...HandlerFunc)
- func (s *HttpServer) GET(relativePath string, handlers ...HandlerFunc)
- func (s *HttpServer) HEAD(relativePath string, handlers ...HandlerFunc)
- func (s *HttpServer) OPTIONS(relativePath string, handlers ...HandlerFunc)
- func (s *HttpServer) PATCH(relativePath string, handlers ...HandlerFunc)
- func (s *HttpServer) POST(relativePath string, handlers ...HandlerFunc)
- func (s *HttpServer) PUT(relativePath string, handlers ...HandlerFunc)
- func (s *HttpServer) Use(middleware ...HandlerFunc)
Constants ¶
const ( HttpHeaderKeyTraceID = "ipalfish-trace-id" WildCharacter = ":" RoutePath = "req-simple-path" HttpHeaderKeyGroup = "ipalfish-group" HttpHeaderKeyHead = "ipalfish-head" CookieNameGroup = "ipalfish_group" DefaultGroup = "" ContextKeyHead = "Head" )
const ErrCodeKey = "ErrCode"
Variables ¶
This section is empty.
Functions ¶
func ContextSetErrCode ¶
func InjectFromRequest ¶
func InjectFromRequest() gin.HandlerFunc
func Recovery ¶
func Recovery() gin.HandlerFunc
Recovery returns a middleware that recovers from any panics and writes a 500 if there was one.
Types ¶
type Head ¶
type Head struct { Uid int64 `thrift:"uid,1" json:"uid"` Source int32 `thrift:"source,2" json:"source"` Ip string `thrift:"ip,3" json:"ip"` Region string `thrift:"region,4" json:"region"` Dt int32 `thrift:"dt,5" json:"dt"` Unionid string `thrift:"unionid,6" json:"unionid"` Did string `thrift:"did,7" json:"did"` Zone int32 `thrift:"zone,8" json:"zone"` ZoneName string `thrift:"zone_name,9" json:"zone_name"` Properties map[string]string `thrift:"properties,10" json:"properties"` }
type HttpServer ¶
HttpServer is the http server, Create an instance of GinServer, by using NewGinServer()
func (*HttpServer) Any ¶
func (s *HttpServer) Any(relativePath string, handlers ...HandlerFunc)
Any registers a route that matches all the HTTP methods.
func (*HttpServer) DELETE ¶
func (s *HttpServer) DELETE(relativePath string, handlers ...HandlerFunc)
DELETE is a shortcut for router.Handle("DELETE", path, handle).
func (*HttpServer) GET ¶
func (s *HttpServer) GET(relativePath string, handlers ...HandlerFunc)
GET is a shortcut for router.Handle("GET", path, handle).
func (*HttpServer) HEAD ¶
func (s *HttpServer) HEAD(relativePath string, handlers ...HandlerFunc)
HEAD is a shortcut for router.Handle("HEAD", path, handle).
func (*HttpServer) OPTIONS ¶
func (s *HttpServer) OPTIONS(relativePath string, handlers ...HandlerFunc)
OPTIONS is a shortcut for router.Handle("OPTIONS", path, handle).
func (*HttpServer) PATCH ¶
func (s *HttpServer) PATCH(relativePath string, handlers ...HandlerFunc)
PATCH is a shortcut for router.Handle("PATCH", path, handle).
func (*HttpServer) POST ¶
func (s *HttpServer) POST(relativePath string, handlers ...HandlerFunc)
POST is a shortcut for router.Handle("POST", path, handle).
func (*HttpServer) PUT ¶
func (s *HttpServer) PUT(relativePath string, handlers ...HandlerFunc)
PUT is a shortcut for router.Handle("PUT", path, handle).
func (*HttpServer) Use ¶
func (s *HttpServer) Use(middleware ...HandlerFunc)
Use attachs a global middleware to the router