Versions in this module Expand all Collapse all v1 v1.0.6 Dec 19, 2022 v1.0.5 Dec 19, 2022 v1.0.4 Dec 19, 2022 v1.0.3 Dec 17, 2022 v1.0.2 Dec 17, 2022 Changes in this version + type RequestFunc func(context.Context, *http.Request) context.Context type Server + func (s *Server) After(after ...ServerResponseFunc) + func (s *Server) Before(before ...RequestFunc) + type ServerResponseFunc func(context.Context, http.ResponseWriter) context.Context v1.0.1 Dec 14, 2022 v1.0.0 Dec 14, 2022 Changes in this version + func DefaultEncodeResponse(ctx context.Context, writer http.ResponseWriter, response any) error + func DefaultErrorEncoder(ctx context.Context, err error, writer http.ResponseWriter) + func NewResponse(success bool, code int, message string, data any) error + type Client struct + Config ClientConfig + Nacos *nacos.Nacos + func NewClient(n *nacos.Nacos) *Client + func (c *Client) Do(ctx context.Context, serverName string, path string, method string, req []byte) (any, error) + func (c *Client) Run(ctx context.Context, url string, method string, data []byte) ([]byte, error) + type ClientConfig struct + Retry int64 + Timeout int64 + type DecodeRequestFunc func(ctx context.Context, r *http.Request) (req any, err error) + type EncodeResponseFunc func(ctx context.Context, w http.ResponseWriter, res any) error + type ErrorEncoder func(ctx context.Context, err error, w http.ResponseWriter) + type Handler struct + DecodeRequest DecodeRequestFunc + EncodeResponse EncodeResponseFunc + Endpoint endpoint.Endpoint + ErrorEncoder ErrorEncoder + func NewHandler(decode DecodeRequestFunc, endpoint endpoint.Endpoint) *Handler + func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Response struct + Code int + Data any + Message string + Success bool + func (s Response) Error() string + type Server struct + Config ServerConfig + Handler http.Handler + Limiter *limiter.Limiter + Nacos *nacos.Nacos + func NewServer(c ServerConfig, h http.Handler, l *limiter.Limiter, n *nacos.Nacos) *Server + func (s *Server) Run() error + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + type ServerConfig struct + Host string + Metadata map[string]string + Name string + Port string + ReadTimeout int64 + WriteTimeout int64