Documentation ¶
Index ¶
- Constants
- func Bind(ctx *Context, obj any) error
- func BindBody(ctx *Context, obj any) error
- func BindQuery(ctx *Context, target interface{}) error
- func BindURI(ctx *Context, target interface{}) error
- func CodecForRequest(c *Context, name string) (encoding.Codec, bool)
- func CodecName(name string) string
- func ContentType(subtype string) string
- func DefaultErrorEncoder(c *Context, err error)
- func DefaultRequestDecoder(c *Context, v interface{}) error
- func DefaultRequestQuery(c *Context, v interface{}) error
- func DefaultRequestVars(c *Context, v interface{}) error
- func DefaultResponseEncoder(c *Context, v interface{}) error
- func EncodeURL(pathTemplate string, msg interface{}, needQuery bool) string
- func FromContext(ctx context.Context) (*gin.Context, bool)
- func NewContext(ctx *gin.Context) context.Context
- func NewEndpoint(scheme, host string) *url.URL
- func ParseEndpoint(endpoints []string, scheme string) (string, error)
- func Scheme(scheme string, isSecure bool) string
- func SetOperation(ctx context.Context, op string)
- type CallOption
- type Client
- type Context
- type DecodeRequestFunc
- type EncodeErrorFunc
- type EncodeResponseFunc
- type Engine
- type Flusher
- type HandlerFunc
- type IRouter
- type IRoutes
- type Redirector
- type Request
- type ResponseController
- type ResponseWriter
- type RouteInfo
- type RouterGroup
- type RoutesInfo
- type Server
- func (s *Server) Any(path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) DELETE(path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) Endpoint() (*url.URL, error)
- func (s *Server) GET(path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) Group(path string, handlers ...HandlerFunc) *RouterGroup
- func (s *Server) HEAD(path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) Handle(method, path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) Match(methods []string, path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) OPTIONS(path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) PATCH(path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) POST(path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) PUT(path string, handlers ...HandlerFunc) IRoutes
- func (s *Server) Route(prefix string, filters ...HandlerFunc) IRoutes
- func (s *Server) ServeHTTP(res http.ResponseWriter, req *http.Request)
- func (s *Server) Start(ctx context.Context) error
- func (s *Server) Static(path string, root string) IRoutes
- func (s *Server) StaticFS(path string, system http.FileSystem) IRoutes
- func (s *Server) StaticFile(path string, filepath string) IRoutes
- func (s *Server) StaticFileFS(path string, filepath string, system http.FileSystem) IRoutes
- func (s *Server) Stop(ctx context.Context) error
- func (s *Server) Use(handlers ...HandlerFunc) IRoutes
- func (s *Server) WalkHandle(handle func(method, path string, handler http.HandlerFunc)) error
- func (s *Server) WalkRoute(fn WalkRouteFunc) error
- type ServerOption
- func Address(addr string) ServerOption
- func Endpoint(endpoint *url.URL) ServerOption
- func ErrorEncoder(en EncodeErrorFunc) ServerOption
- func Filter(filters ...HandlerFunc) ServerOption
- func Listener(lis net.Listener) ServerOption
- func MethodNotAllowedHandler(handlers ...HandlerFunc) ServerOption
- func Middleware(m ...middleware.Middleware) ServerOption
- func Network(network string) ServerOption
- func NotFoundHandler(handlers ...HandlerFunc) ServerOption
- func RequestDecoder(dec DecodeRequestFunc) ServerOption
- func ResponseEncoder(en EncodeResponseFunc) ServerOption
- func StrictSlash(strictSlash bool) ServerOption
- func TLSConfig(c *tls.Config) ServerOption
- func Timeout(timeout time.Duration) ServerOption
- func WithLogger(l log.Logger) ServerOption
- func WithTLSConfig(c *tls.Config) ServerOption
- type Transport
- func (tr *Transport) Endpoint() string
- func (tr *Transport) Kind() transport.Kind
- func (tr *Transport) Operation() string
- func (tr *Transport) PathTemplate() string
- func (tr *Transport) ReplyHeader() transport.Header
- func (tr *Transport) Request() *http.Request
- func (tr *Transport) RequestHeader() transport.Header
- type Transporter
- type WalkRouteFunc
Constants ¶
const (
ErrorTypePrivate = gin.ErrorTypePrivate
)
const (
KindGin transport.Kind = "gin"
)
const SupportPackageIsVersion1 = transhttp.SupportPackageIsVersion1
SupportPackageIsVersion1 These constants should not be referenced from any other code.
Variables ¶
This section is empty.
Functions ¶
func CodecForRequest ¶
CodecForRequest get encoding.Codec via http.Request
func ContentType ¶
ContentType returns the content-type with base prefix.
func DefaultErrorEncoder ¶
DefaultErrorEncoder encodes the error to the HTTP response.
func DefaultRequestDecoder ¶
DefaultRequestDecoder decodes the request body to object.
func DefaultRequestQuery ¶
DefaultRequestQuery decodes the request vars to object.
func DefaultRequestVars ¶
DefaultRequestVars decodes the request vars to object.
func DefaultResponseEncoder ¶
DefaultResponseEncoder encodes the object to the HTTP response.
func FromContext ¶
FromContext takes a context as an argument and returns a pointer to a gin.Context and a boolean value.
func NewContext ¶
NewContext creates a new context from a gin context
func ParseEndpoint ¶
ParseEndpoint parses an Endpoint URL.
func Scheme ¶
Scheme is the scheme of endpoint url. examples: scheme="http",isSecure=true get "https"
func SetOperation ¶
SetOperation sets the transport operation.
Types ¶
type CallOption ¶
type CallOption = transhttp.CallOption
CallOption configures a Call before it starts or extracts information from a Call after it completes.
type DecodeRequestFunc ¶
DecodeRequestFunc is decode request func.
type EncodeErrorFunc ¶
EncodeErrorFunc is encode error func.
type EncodeResponseFunc ¶
EncodeResponseFunc is encode response func.
type HandlerFunc ¶
type HandlerFunc = gin.HandlerFunc
func Logger ¶
func Logger(logger log.Logger) HandlerFunc
Logger receives the gin framework default log
func Middlewares ¶
func Middlewares(m ...middleware.Middleware) HandlerFunc
Middlewares return middlewares wrapper
type Redirector ¶
Redirector replies to the request with a redirect to url which may be a path relative to the request path.
type ResponseController ¶
type ResponseController = http.ResponseController
ResponseController is type net/http.ResponseController which was added in Go 1.20.
type RouterGroup ¶
type RouterGroup = gin.RouterGroup
type RoutesInfo ¶
type RoutesInfo = gin.RoutesInfo
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(opts ...ServerOption) *Server
func (*Server) Group ¶
func (s *Server) Group(path string, handlers ...HandlerFunc) *RouterGroup
func (*Server) Handle ¶
func (s *Server) Handle(method, path string, handlers ...HandlerFunc) IRoutes
func (*Server) Match ¶
func (s *Server) Match(methods []string, path string, handlers ...HandlerFunc) IRoutes
func (*Server) StaticFileFS ¶
func (*Server) Use ¶
func (s *Server) Use(handlers ...HandlerFunc) IRoutes
func (*Server) WalkHandle ¶
func (s *Server) WalkHandle(handle func(method, path string, handler http.HandlerFunc)) error
WalkHandle walks the router and all its sub-routers, calling walkFn for each route in the tree.
func (*Server) WalkRoute ¶
func (s *Server) WalkRoute(fn WalkRouteFunc) error
WalkRoute walks the router and all its sub-routers, calling walkFn for each route in the tree.
type ServerOption ¶
type ServerOption func(*Server)
func Address ¶
func Address(addr string) ServerOption
func ErrorEncoder ¶
func ErrorEncoder(en EncodeErrorFunc) ServerOption
func MethodNotAllowedHandler ¶
func MethodNotAllowedHandler(handlers ...HandlerFunc) ServerOption
func Middleware ¶
func Middleware(m ...middleware.Middleware) ServerOption
Middleware with service middleware option.
func NotFoundHandler ¶
func NotFoundHandler(handlers ...HandlerFunc) ServerOption
func RequestDecoder ¶
func RequestDecoder(dec DecodeRequestFunc) ServerOption
RequestDecoder with request decoder.
func ResponseEncoder ¶
func ResponseEncoder(en EncodeResponseFunc) ServerOption
ResponseEncoder with response encoder.
func StrictSlash ¶
func StrictSlash(strictSlash bool) ServerOption
func WithTLSConfig ¶
func WithTLSConfig(c *tls.Config) ServerOption
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is an HTTP transport.
func (*Transport) PathTemplate ¶
PathTemplate returns the http path template.
func (*Transport) ReplyHeader ¶
ReplyHeader returns the reply header.
func (*Transport) RequestHeader ¶
RequestHeader returns the request header.
type WalkRouteFunc ¶
WalkRouteFunc is the type of the function called for each route visited by Walk.