Documentation ¶
Index ¶
- Constants
- Variables
- func Cors() middleware.Middleware
- func FromIrisContext(ctx context.Context) (c iris.Context, ok bool)
- func Handle(handleFunc func(ctx *Context)) iriscontext.Handler
- func JwtAuth(secret ...string) iris.Handler
- func Metrics() middleware.Middleware
- func Middlewares(m ...middleware.Middleware) iriscontext.Handler
- func NewIrisContext(ctx context.Context, c iris.Context) context.Context
- func RateLimit(opts ...bbr.Option) middleware.Middleware
- func Recovery() middleware.Middleware
- func RegisterLogValuers(ms map[string]LogValuer)
- func RegisterOnErrorCode(app *iris.Application, codes ...int)
- func StartAt() middleware.Middleware
- type Context
- func (c *Context) GetLimitAndOffset(isQueryAll bool, maxLimit ...int) (limit, offset int)
- func (c *Context) HandlerName() string
- func (c *Context) PathParams() map[string]string
- func (c *Context) ProcessTime() (processTime int64)
- func (c *Context) ReadJSONValidate(outPtr interface{}) error
- func (c *Context) ReadQueryValidate(ptr interface{}) error
- func (c *Context) Render(status ecode.Status, data interface{}, httpCode ...int)
- func (c *Context) RenderError(status ecode.Status, data interface{}, httpCode ...int)
- func (c *Context) RenderErrorWithMsg(status ecode.Status, data interface{}, msg string, httpCode ...int)
- func (c *Context) RenderHTML(httpCode int, text string, levels ...log.Level)
- func (c *Context) RenderResult(res *result.Result)
- func (c *Context) RenderText(httpCode int, text string, levels ...log.Level)
- func (c *Context) RenderWithMsg(status ecode.Status, data interface{}, msg string, httpCode ...int)
- type LogValuer
Constants ¶
View Source
const (
// JwtTokenKey ...
JwtTokenKey = "jwtToken"
)
Variables ¶
View Source
var ( // WithRemoteAddrHeaders ... WithRemoteAddrHeaders = func(app *iris.Application) { app.Configure(iris.WithRemoteAddrHeader("X-Forwarded-For"), iris.WithRemoteAddrHeader("X-Real-Ip")) } // DefaultConfigures ... DefaultConfigures = []iris.Configurator{iris.WithoutBodyConsumptionOnUnmarshal, iris.WithoutPathCorrectionRedirection, WithRemoteAddrHeaders} // DefaultErrorCodes ... DefaultErrorCodes = []int{http.StatusInternalServerError, http.StatusNotFound, http.StatusTooManyRequests} )
View Source
var DefaultMiddlewares = []middleware.Middleware{StartAt(), tracing.Server(), Metrics(), Recovery(), Cors(), RateLimit(bbr.WithCPUThreshold(900))}
DefaultMiddlewares ...
Functions ¶
func FromIrisContext ¶
FromIrisContext ...
func Middlewares ¶
func Middlewares(m ...middleware.Middleware) iriscontext.Handler
Middlewares return middlewares wrapper
func NewIrisContext ¶
NewIrisContext ...
func RegisterOnErrorCode ¶
func RegisterOnErrorCode(app *iris.Application, codes ...int)
RegisterOnErrorCode ...
Types ¶
type Context ¶
type Context struct { iris.Context // contains filtered or unexported fields }
Context ...
func (*Context) GetLimitAndOffset ¶
GetLimitAndOffset ...
func (*Context) ReadJSONValidate ¶
ReadJSONValidate ...
func (*Context) ReadQueryValidate ¶
ReadQueryValidate ...
func (*Context) RenderError ¶
RenderError ...
func (*Context) RenderErrorWithMsg ¶
func (c *Context) RenderErrorWithMsg(status ecode.Status, data interface{}, msg string, httpCode ...int)
RenderErrorWithMsg ...
func (*Context) RenderHTML ¶
RenderHTML ...
func (*Context) RenderText ¶
RenderText ...
Click to show internal directories.
Click to hide internal directories.