Documentation ¶
Index ¶
- Constants
- Variables
- func GRPCProxyWrapper(h interface{}) echo.HandlerFunc
- func ProtoError(c echo.Context, code int, e error) error
- func ProtoJSON(c echo.Context, code int, i interface{}) error
- type BindUnmarshaler
- type Config
- type HTTPError
- type ProtoBinder
- func (b *ProtoBinder) Bind(i interface{}, c echo.Context) (err error)
- func (b *ProtoBinder) BindBody(c echo.Context, i interface{}) (err error)
- func (b *ProtoBinder) BindHeaders(c echo.Context, i interface{}) error
- func (b *ProtoBinder) BindPathParams(c echo.Context, i interface{}) error
- func (b *ProtoBinder) BindQueryParams(c echo.Context, i interface{}) error
- type Server
Constants ¶
const ( // HeaderAcceptEncoding ... HeaderAcceptEncoding = "Accept-Encoding" // HeaderContentType ... HeaderContentType = "Content-Type" // HRPC Errord HeaderHRPCErr = "HRPC-Errord" )
Headers
const ( // MIMEApplicationJSON ... MIMEApplicationJSON = "application/json" // MIMEApplicationJSONCharsetUTF8 ... MIMEApplicationJSONCharsetUTF8 = MIMEApplicationJSON + "; " + charsetUTF8 // MIMEApplicationProtobuf ... MIMEApplicationProtobuf = "application/protobuf" )
MIME types
Variables ¶
var ( // ErrGRPCResponseValid ... ErrGRPCResponseValid = status.Errorf(codes.Internal, "response valid") // ErrGRPCInvokeLen ... ErrGRPCInvokeLen = status.Errorf(codes.Internal, "invoke request without len 2 res") )
var ErrNotFound = HTTPError{ Code: http.StatusNotFound, Message: "not found", }
ErrNotFound defines StatusNotFound error.
Functions ¶
Types ¶
type BindUnmarshaler ¶ added in v0.10.2
type BindUnmarshaler = echo.BindUnmarshaler
BindUnmarshaler is the interface used to wrap the UnmarshalParam method. Types that don't implement this, but do implement encoding.TextUnmarshaler will use that interface instead.
type Config ¶
type Config struct { Host string Port int Deployment string Debug bool DisableMetric bool DisableTrace bool DisableSentinel bool CertFile string PrivateFile string EnableTLS bool SlowQueryThresholdInMilli int64 // contains filtered or unexported fields }
Config HTTP config
func (*Config) WithLogger ¶
WithLogger ...
type HTTPError ¶
HTTPError wraps handler error.
func NewHTTPError ¶
NewHTTPError constructs a new HTTPError instance.
type ProtoBinder ¶ added in v0.10.2
type ProtoBinder struct{}
ProtoBinder is the default implementation of the Binder interface.
func (*ProtoBinder) Bind ¶ added in v0.10.2
func (b *ProtoBinder) Bind(i interface{}, c echo.Context) (err error)
Bind implements the `Binder#Bind` function. Binding is done in following order: 1) path params; 2) query params; 3) request body. Each step COULD override previous step binded values. For single source binding use their own methods BindBody, BindQueryParams, BindPathParams.
func (*ProtoBinder) BindBody ¶ added in v0.10.2
func (b *ProtoBinder) BindBody(c echo.Context, i interface{}) (err error)
BindBody binds request body contents to bindable object NB: then binding forms take note that this implementation uses standard library form parsing which parses form data from BOTH URL and BODY if content type is not echo.MIMEMultipartForm See non-echo.MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseForm See echo.MIMEMultipartForm: https://golang.org/pkg/net/http/#Request.ParseMultipartForm
func (*ProtoBinder) BindHeaders ¶ added in v0.10.2
func (b *ProtoBinder) BindHeaders(c echo.Context, i interface{}) error
BindHeaders binds HTTP headers to a bindable object
func (*ProtoBinder) BindPathParams ¶ added in v0.10.2
func (b *ProtoBinder) BindPathParams(c echo.Context, i interface{}) error
BindPathParams binds path params to bindable object
func (*ProtoBinder) BindQueryParams ¶ added in v0.10.2
func (b *ProtoBinder) BindQueryParams(c echo.Context, i interface{}) error
BindQueryParams binds query params to bindable object
type Server ¶
type Server struct { *echo.Echo // contains filtered or unexported fields }
Server ...
func (*Server) GracefulStop ¶
GracefulStop implements server.Server interface it will stop echo server gracefully
func (*Server) Info ¶
func (s *Server) Info() *server.ServiceInfo
Info returns server info, used by governor and consumer balancer