xiris

package
v0.0.0-...-c702e84 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 36 Imported by: 0

Documentation

Index

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}
)

DefaultMiddlewares ...

Functions

func Cors

func Cors() middleware.Middleware

Cors ...

func FromIrisContext

func FromIrisContext(ctx context.Context) (c iris.Context, ok bool)

FromIrisContext ...

func Handle

func Handle(handleFunc func(ctx *Context)) iriscontext.Handler

Handle ...

func JwtAuth

func JwtAuth(secret ...string) iris.Handler

JwtAuth iris auth middleware

func Metrics

func Metrics() middleware.Middleware

Metrics ...

func Middlewares

func Middlewares(m ...middleware.Middleware) iriscontext.Handler

Middlewares return middlewares wrapper

func NewIrisContext

func NewIrisContext(ctx context.Context, c iris.Context) context.Context

NewIrisContext ...

func RateLimit

func RateLimit(opts ...bbr.Option) middleware.Middleware

RateLimit ...

func Recovery

func Recovery() middleware.Middleware

Recovery ...

func RegisterLogValuers

func RegisterLogValuers(ms map[string]LogValuer)

RegisterLogValuers ...

func RegisterOnErrorCode

func RegisterOnErrorCode(app *iris.Application, codes ...int)

RegisterOnErrorCode ...

func StartAt

func StartAt() middleware.Middleware

StartAt ...

Types

type Context

type Context struct {
	iris.Context
	// contains filtered or unexported fields
}

Context ...

func NewContext

func NewContext(ctx iris.Context) *Context

NewContext ...

func (*Context) GetLimitAndOffset

func (c *Context) GetLimitAndOffset(isQueryAll bool, maxLimit ...int) (limit, offset int)

GetLimitAndOffset ...

func (*Context) HandlerName

func (c *Context) HandlerName() string

HandlerName ...

func (*Context) PathParams

func (c *Context) PathParams() map[string]string

PathParams ...

func (*Context) ProcessTime

func (c *Context) ProcessTime() (processTime int64)

ProcessTime ...

func (*Context) ReadJSONValidate

func (c *Context) ReadJSONValidate(outPtr interface{}) error

ReadJSONValidate ...

func (*Context) ReadQueryValidate

func (c *Context) ReadQueryValidate(ptr interface{}) error

ReadQueryValidate ...

func (*Context) Render

func (c *Context) Render(status ecode.Status, data interface{}, httpCode ...int)

Render iris render

func (*Context) RenderError

func (c *Context) RenderError(status ecode.Status, data interface{}, httpCode ...int)

RenderError ...

func (*Context) RenderErrorWithMsg

func (c *Context) RenderErrorWithMsg(status ecode.Status, data interface{}, msg string, httpCode ...int)

RenderErrorWithMsg ...

func (*Context) RenderHTML

func (c *Context) RenderHTML(httpCode int, text string, levels ...log.Level)

RenderHTML ...

func (*Context) RenderResult

func (c *Context) RenderResult(res *result.Result)

RenderResult ...

func (*Context) RenderText

func (c *Context) RenderText(httpCode int, text string, levels ...log.Level)

RenderText ...

func (*Context) RenderWithMsg

func (c *Context) RenderWithMsg(status ecode.Status, data interface{}, msg string, httpCode ...int)

RenderWithMsg ...

type LogValuer

type LogValuer func(ctx *Context) interface{}

LogValuer ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL