Versions in this module Expand all Collapse all v1 v1.0.0 May 5, 2022 Changes in this version + const StatusAccessDenied + const StatusBodyInvalid + const StatusDataProcessingFailed + const StatusInvalidSign + const StatusLoginFailed + const StatusNotFound + const StatusNotLegalInput + const StatusOK + const StatusSaveDataFailed + const TypeHtml + const TypeJson + const TypePlain + type APIInfo struct + Handler Handle + Name string + Perm uint + type Context struct + Begin time.Time + Body *bytes.Buffer + BodyLen int64 + BodyMap map[string]interface{} + ContextType string + Keys map[string]interface{} + NoLog bool + OpLog *bytes.Buffer + Params httprouter.Params + Perm uint + Req *http.Request + Response interface{} + Writer *ResponseWriter + func (ctx *Context) RemoteAddr(xff bool) string + func (ctx *Context) ReqBody(out interface{}) (ecode int, err error) + func (ctx *Context) Upload(savedir, allowExt string) (string, string, error) + type Handle func(ctx *Context) + type HttpTest struct + IsSimple bool + OPT options.GlobalOPT + Router *Router + Valid bool + func NewTest(conf string) HttpTest + func (ht HttpTest) HttpApiTest(req *http.Request) + type PrometheusList struct + ConcurrencyLimitExceeded prometheus.Counter + RequestsInFlight prometheus.Gauge + RequestsTotal *prometheus.CounterVec + RequestsURLTotal *prometheus.CounterVec + type RespMsg struct + Code int + DataList interface{} + Message string + PageNo int + PageSize int + TotalRecord int + func NewRespMsg(code int) *RespMsg + func (rmsg *RespMsg) Bytes() (rstr []byte) + func (rmsg *RespMsg) SetCode(code int) error + func (rmsg *RespMsg) Strings() (rstr string) + type ResponseWriter struct + func NewResponseWriter(w http.ResponseWriter) *ResponseWriter + func (lrw *ResponseWriter) AbortWithStatus(code int) + func (lrw *ResponseWriter) Size() int + func (lrw *ResponseWriter) Status() int + func (lrw *ResponseWriter) Write(data []byte) (n int, err error) + func (lrw *ResponseWriter) WriteHeader(code int) + func (lrw *ResponseWriter) WriteString(s string) (n int, err error) + func (lrw *ResponseWriter) Written() bool + type Router struct + ConcurrencyLimitExceeded prometheus.Counter + ErrLog *mlog.Logger + PanicHandler func(*Context) + Prefix string + PrometheusList PrometheusList + RequestsInFlight prometheus.Gauge + ResponseHandler func(*Context) + func NewRouter(sver string, alog *mlog.Logger) *Router + func (router *Router) AddRoute(method, path string, perm uint, conf interface{}, handlers ...Handle) + func (router *Router) NotFound() + func (router *Router) PutRouterList(rl *RouterList, conf interface{}) + func (router *Router) ServeHTTP(w http.ResponseWriter, req *http.Request) + func (router *Router) SetupPrometheus() + type RouterList struct + API map[string]APIInfo + Privilege Handle + func NewRouteList() *RouterList