Documentation ¶
Index ¶
- Constants
- func Cors(opts ...CORSOption) gin.HandlerFunc
- func InjectRspToContext(c *gin.Context, rsp string)
- func MetricInterceptor() gin.HandlerFunc
- func OpentracingInterceptor() gin.HandlerFunc
- func RequestFromServerContext(ctx context.Context) (*http.Request, bool)
- func RspFromContext(c *gin.Context) string
- func SetCookie(ctx context.Context, cookie *http.Cookie)
- func SetOperation(ctx context.Context, op string)
- type CORSOption
- func AllowAllOrigins() CORSOption
- func AllowBrowserExtensions() CORSOption
- func AllowCredentials() CORSOption
- func AllowFiles() CORSOption
- func AllowHeaders(h ...string) CORSOption
- func AllowMethods(m ...string) CORSOption
- func AllowOriginFunc(f func(string) bool) CORSOption
- func AllowOriginWithContextFunc(f func(c *gin.Context, origin string) bool) CORSOption
- func AllowOrigins(args ...string) CORSOption
- func AllowPrivateNetwork() CORSOption
- func AllowWebSockets() CORSOption
- func AllowWildcard() CORSOption
- func CustomSchemas(schemas ...string) CORSOption
- func ExposeHeaders(h ...string) CORSOption
- func MaxAge(t time.Duration) CORSOption
- func OptionsResponseStatusCode(statusCode int) CORSOption
- type EngineCustomizer
- type Server
- func (s *Server) Customize(loader EngineCustomizer)
- func (s *Server) DELETE(relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) Endpoint() (*url.URL, error)
- func (s *Server) GET(relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) HEAD(relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) Handle(httpMethod, relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) HandleAny(relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) Match(methods []string, relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) OPTIONS(relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) PATCH(relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) POST(relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) PUT(relativePath string, handlers ...gin.HandlerFunc)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Stop(ctx context.Context) error
- func (s *Server) Use(fn gin.HandlerFunc)
- type ServerOption
- func Address(address string) ServerOption
- func Debug() ServerOption
- func Endpoint(endpoint *url.URL) ServerOption
- func Env(env string) ServerOption
- func Listener(lis net.Listener) ServerOption
- func Middlewares(fns ...gin.HandlerFunc) ServerOption
- func Network(network string) ServerOption
- func ReadTimeout(t time.Duration) ServerOption
- func ServiceName(name string) ServerOption
- func TLSConfig(c *tls.Config) ServerOption
- func Timeout(t time.Duration) ServerOption
- func WriteTimeout(t time.Duration) ServerOption
- type Transport
- func (tr *Transport) Endpoint() string
- func (tr *Transport) G() *gin.Context
- func (tr *Transport) Kind() transport.Kind
- func (tr *Transport) Operation() string
- func (tr *Transport) ReplyHeader() transport.Header
- func (tr *Transport) Request() *http.Request
- func (tr *Transport) RequestHeader() transport.Header
- type Transporter
Constants ¶
const ( TraceKeyQuery = "_query_string" TraceKeyReq = "_request" TraceKeyReqBody = "_request_body" TraceKeyRsp = "_response" RspCtxKey = "_rsp_ctx_key" )
Variables ¶
This section is empty.
Functions ¶
func Cors ¶
func Cors(opts ...CORSOption) gin.HandlerFunc
func InjectRspToContext ¶
func MetricInterceptor ¶
func MetricInterceptor() gin.HandlerFunc
func OpentracingInterceptor ¶
func OpentracingInterceptor() gin.HandlerFunc
func RspFromContext ¶
func SetOperation ¶
Types ¶
type CORSOption ¶
type CORSOption func(*corsOptions)
func AllowAllOrigins ¶
func AllowAllOrigins() CORSOption
func AllowBrowserExtensions ¶
func AllowBrowserExtensions() CORSOption
func AllowCredentials ¶
func AllowCredentials() CORSOption
func AllowFiles ¶
func AllowFiles() CORSOption
func AllowHeaders ¶
func AllowHeaders(h ...string) CORSOption
func AllowMethods ¶
func AllowMethods(m ...string) CORSOption
func AllowOriginFunc ¶
func AllowOriginFunc(f func(string) bool) CORSOption
func AllowOriginWithContextFunc ¶
func AllowOriginWithContextFunc(f func(c *gin.Context, origin string) bool) CORSOption
func AllowOrigins ¶
func AllowOrigins(args ...string) CORSOption
func AllowPrivateNetwork ¶
func AllowPrivateNetwork() CORSOption
func AllowWebSockets ¶
func AllowWebSockets() CORSOption
func AllowWildcard ¶
func AllowWildcard() CORSOption
func CustomSchemas ¶
func CustomSchemas(schemas ...string) CORSOption
func ExposeHeaders ¶
func ExposeHeaders(h ...string) CORSOption
func MaxAge ¶
func MaxAge(t time.Duration) CORSOption
func OptionsResponseStatusCode ¶
func OptionsResponseStatusCode(statusCode int) CORSOption
type EngineCustomizer ¶
type Server ¶
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
func (*Server) Customize ¶
func (s *Server) Customize(loader EngineCustomizer)
func (*Server) DELETE ¶
func (s *Server) DELETE(relativePath string, handlers ...gin.HandlerFunc)
DELETE is a shortcut for router.Handle("DELETE", path, handlers).
func (*Server) GET ¶
func (s *Server) GET(relativePath string, handlers ...gin.HandlerFunc)
GET is a shortcut for router.Handle("GET", path, handlers).
func (*Server) HEAD ¶
func (s *Server) HEAD(relativePath string, handlers ...gin.HandlerFunc)
HEAD is a shortcut for router.Handle("HEAD", path, handlers).
func (*Server) Handle ¶
func (s *Server) Handle(httpMethod, relativePath string, handlers ...gin.HandlerFunc)
Handle registers a new request handle and middleware with the given path and method. The last handler should be the real handler, the other ones should be middleware that can and should be shared among different routes. See the example code in GitHub.
For GET, POST, PUT, PATCH and DELETE requests the respective shortcut functions can be used.
This function is intended for bulk loading and to allow the usage of less frequently used, non-standardized or custom methods (e.g. for internal communication with a proxy).
func (*Server) HandleAny ¶
func (s *Server) HandleAny(relativePath string, handlers ...gin.HandlerFunc)
HandleAny registers a route that matches all the HTTP methods. GET, POST, PUT, PATCH, HEAD, OPTIONS, DELETE, CONNECT, TRACE.
func (*Server) Match ¶
func (s *Server) Match(methods []string, relativePath string, handlers ...gin.HandlerFunc)
Match registers a route that matches the specified methods that you declared.
func (*Server) OPTIONS ¶
func (s *Server) OPTIONS(relativePath string, handlers ...gin.HandlerFunc)
OPTIONS is a shortcut for router.Handle("OPTIONS", path, handlers).
func (*Server) PATCH ¶
func (s *Server) PATCH(relativePath string, handlers ...gin.HandlerFunc)
PATCH is a shortcut for router.Handle("PATCH", path, handlers).
func (*Server) POST ¶
func (s *Server) POST(relativePath string, handlers ...gin.HandlerFunc)
POST is a shortcut for router.Handle("POST", path, handlers).
func (*Server) PUT ¶
func (s *Server) PUT(relativePath string, handlers ...gin.HandlerFunc)
PUT is a shortcut for router.Handle("PUT", path, handlers).
func (*Server) Use ¶
func (s *Server) Use(fn gin.HandlerFunc)
type ServerOption ¶
type ServerOption func(*Server)
func Address ¶
func Address(address string) ServerOption
func Debug ¶
func Debug() ServerOption
func Endpoint ¶
func Endpoint(endpoint *url.URL) ServerOption
func Env ¶
func Env(env string) ServerOption
func Listener ¶
func Listener(lis net.Listener) ServerOption
func Middlewares ¶
func Middlewares(fns ...gin.HandlerFunc) ServerOption
func Network ¶
func Network(network string) ServerOption
func ReadTimeout ¶
func ReadTimeout(t time.Duration) ServerOption
func ServiceName ¶
func ServiceName(name string) ServerOption
func TLSConfig ¶
func TLSConfig(c *tls.Config) ServerOption
func Timeout ¶
func Timeout(t time.Duration) ServerOption
func WriteTimeout ¶
func WriteTimeout(t time.Duration) ServerOption
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}