Documentation
¶
Index ¶
- Variables
- func DefaultCORS(c *fiber.Ctx) error
- func NewAuthInterceptor(excludePaths []string, itp func(c *fiber.Ctx) error) func(c *fiber.Ctx) error
- func ReleaseCtx(c *FiberContext)
- type FiberContext
- func (c *FiberContext) BindQuery(obj any) error
- func (c *FiberContext) BodyParser(obj any) error
- func (c *FiberContext) ClientIP() string
- func (c *FiberContext) ContentType() string
- func (c *FiberContext) Cookie(name string) (string, error)
- func (c *FiberContext) Ctx() any
- func (c *FiberContext) CustomBindQueryMethod() bool
- func (c *FiberContext) CustomShouldBindMethod() bool
- func (c *FiberContext) File(filepath string) error
- func (c *FiberContext) FileAttachment(filepath, filename string) error
- func (c *FiberContext) Get(key string) (value any, exists bool)
- func (c *FiberContext) GetHeader(key string) string
- func (c *FiberContext) Header(key, value string)
- func (c *FiberContext) JSON(statusCode int, data any) error
- func (c *FiberContext) JSONP(code int, data any) error
- func (c *FiberContext) Method() string
- func (c *FiberContext) Params(key string, undefined ...string) string
- func (c *FiberContext) Path() string
- func (c *FiberContext) Query(key string, undefined ...string) string
- func (c *FiberContext) Redirect(code int, location string) error
- func (c *FiberContext) RenderHTML(name string, bind interface{}, layouts ...string) error
- func (c *FiberContext) SendStream(stream io.Reader, size ...int) error
- func (c *FiberContext) SendString(s string) error
- func (c *FiberContext) Set(key string, value any)
- func (c *FiberContext) SetCookie(cookie *http.Cookie)
- func (c *FiberContext) ShouldBind(obj any) error
- func (c *FiberContext) Status(statusCode int)
- func (c *FiberContext) TOML(code int, obj any) error
- func (c *FiberContext) Validate(obj any) error
- func (c *FiberContext) Write(p []byte) (int, error)
- func (c *FiberContext) XML(code int, content any) error
- func (c *FiberContext) YAML(code int, obj any) error
- type FiberMux
Constants ¶
This section is empty.
Variables ¶
View Source
var FastApiExcludePaths = []string{ openapi.DocumentUrl, openapi.ReDocumentUrl, "/" + openapi.SwaggerCssName, "/" + openapi.FaviconName, "/" + openapi.FaviconIcoName, "/" + openapi.SwaggerJsName, "/" + openapi.RedocJsName, "/" + openapi.JsonUrl, }
Functions ¶
func DefaultCORS ¶
func DefaultCORS(c *fiber.Ctx) error
func NewAuthInterceptor ¶ added in v0.2.7
func NewAuthInterceptor(excludePaths []string, itp func(c *fiber.Ctx) error) func(c *fiber.Ctx) error
NewAuthInterceptor 请求认证拦截器,验证请求是否需要认证,如果需要认证,则执行拦截器,否则继续执行
@param excludePaths []string 排除的路径,如果请求路径匹配这些路径,则不执行拦截器 @param itp func(c *fiber.Ctx) error 拦截器函数 @return fiber.Handler
func ReleaseCtx ¶ added in v0.2.9
func ReleaseCtx(c *FiberContext)
Types ¶
type FiberContext ¶
type FiberContext struct {
// contains filtered or unexported fields
}
func AcquireCtx ¶ added in v0.2.9
func AcquireCtx(c *fiber.Ctx) *FiberContext
func (*FiberContext) BindQuery ¶
func (c *FiberContext) BindQuery(obj any) error
func (*FiberContext) BodyParser ¶
func (c *FiberContext) BodyParser(obj any) error
func (*FiberContext) ClientIP ¶
func (c *FiberContext) ClientIP() string
func (*FiberContext) ContentType ¶
func (c *FiberContext) ContentType() string
func (*FiberContext) Ctx ¶ added in v0.2.8
func (c *FiberContext) Ctx() any
func (*FiberContext) CustomBindQueryMethod ¶ added in v0.2.9
func (c *FiberContext) CustomBindQueryMethod() bool
func (*FiberContext) CustomShouldBindMethod ¶ added in v0.2.9
func (c *FiberContext) CustomShouldBindMethod() bool
func (*FiberContext) File ¶
func (c *FiberContext) File(filepath string) error
func (*FiberContext) FileAttachment ¶
func (c *FiberContext) FileAttachment(filepath, filename string) error
func (*FiberContext) Get ¶
func (c *FiberContext) Get(key string) (value any, exists bool)
Get fiber 未实现此方法,作为替代可以使用 Context.Get()
func (*FiberContext) GetHeader ¶ added in v0.2.9
func (c *FiberContext) GetHeader(key string) string
GetHeader 获取请求头, 当key不存在时返回空字符串,如果存在多个时,返回逗号分隔的字符串
func (*FiberContext) Header ¶
func (c *FiberContext) Header(key, value string)
func (*FiberContext) Method ¶
func (c *FiberContext) Method() string
func (*FiberContext) Path ¶
func (c *FiberContext) Path() string
func (*FiberContext) RenderHTML ¶ added in v0.2.9
func (c *FiberContext) RenderHTML(name string, bind interface{}, layouts ...string) error
RenderHTML 返回HTML模板
func (*FiberContext) SendStream ¶
func (c *FiberContext) SendStream(stream io.Reader, size ...int) error
func (*FiberContext) SendString ¶
func (c *FiberContext) SendString(s string) error
func (*FiberContext) Set ¶
func (c *FiberContext) Set(key string, value any)
Set fiber 未实现此方法,作为替代可以使用 Context.Set()
func (*FiberContext) SetCookie ¶
func (c *FiberContext) SetCookie(cookie *http.Cookie)
func (*FiberContext) ShouldBind ¶
func (c *FiberContext) ShouldBind(obj any) error
func (*FiberContext) Status ¶
func (c *FiberContext) Status(statusCode int)
func (*FiberContext) Validate ¶
func (c *FiberContext) Validate(obj any) error
Click to show internal directories.
Click to hide internal directories.