Documentation ¶
Index ¶
- func HttpError(wr http.ResponseWriter, status int, info string, showtrace bool)
- type HttpConfig
- type RequestHandler
- type RequestMapping
- type RequestMethod
- type ResponseWrapper
- type RestController
- type RestServer
- func (s *RestServer) AddInterceptor(interceptor midware.Interceptor)
- func (s *RestServer) AddResponseWrapper(wrapper ResponseWrapper)
- func (s *RestServer) DELETE(pattern string, handler RequestHandler) *RestServer
- func (s *RestServer) GET(pattern string, handler RequestHandler) *RestServer
- func (s *RestServer) Mapping(method RequestMethod, pattern string, handler RequestHandler) *RestServer
- func (s *RestServer) POST(pattern string, handler RequestHandler) *RestServer
- func (s *RestServer) PUT(pattern string, handler RequestHandler) *RestServer
- func (s *RestServer) StartServer()
- func (s *RestServer) StartServerAsync() *http.Server
- func (c *RestServer) WithSQL(sql *sql.SQL)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HttpConfig ¶
type RequestHandler ¶
type RequestHandler func(ctx *common.RequestCtx) interface{}
type RequestMapping ¶
type RequestMapping struct {
// contains filtered or unexported fields
}
type RequestMethod ¶
type RequestMethod string
const ( Get RequestMethod = "GET" Post RequestMethod = "POST" Put RequestMethod = "PUT" Delete RequestMethod = "DELETE" Head RequestMethod = "HEAD" Options RequestMethod = "OPTIONS" )
type ResponseWrapper ¶
type ResponseWrapper interface {
Wrap(v interface{}, wr http.ResponseWriter) bool
}
customize response by handle it manually return true if handled
type RestController ¶
type RestController struct {
// contains filtered or unexported fields
}
func (*RestController) ServeHTTP ¶
func (c *RestController) ServeHTTP(wr http.ResponseWriter, r *http.Request)
type RestServer ¶
type RestServer struct {
// contains filtered or unexported fields
}
func NewRestServer ¶
func NewRestServer(address string, config *HttpConfig) *RestServer
func (*RestServer) AddInterceptor ¶
func (s *RestServer) AddInterceptor(interceptor midware.Interceptor)
func (*RestServer) AddResponseWrapper ¶
func (s *RestServer) AddResponseWrapper(wrapper ResponseWrapper)
append to the top of response
func (*RestServer) DELETE ¶
func (s *RestServer) DELETE(pattern string, handler RequestHandler) *RestServer
func (*RestServer) GET ¶
func (s *RestServer) GET(pattern string, handler RequestHandler) *RestServer
func (*RestServer) Mapping ¶
func (s *RestServer) Mapping(method RequestMethod, pattern string, handler RequestHandler) *RestServer
func (*RestServer) POST ¶
func (s *RestServer) POST(pattern string, handler RequestHandler) *RestServer
func (*RestServer) PUT ¶
func (s *RestServer) PUT(pattern string, handler RequestHandler) *RestServer
func (*RestServer) StartServer ¶
func (s *RestServer) StartServer()
func (*RestServer) StartServerAsync ¶
func (s *RestServer) StartServerAsync() *http.Server
func (*RestServer) WithSQL ¶
func (c *RestServer) WithSQL(sql *sql.SQL)
Click to show internal directories.
Click to hide internal directories.