fiberWrapper

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Types

type FiberContext

type FiberContext struct {
	// contains filtered or unexported fields
}

func (*FiberContext) BindQuery

func (c *FiberContext) BindQuery(obj any) error

func (*FiberContext) BindQueryNotImplemented

func (c *FiberContext) BindQueryNotImplemented() bool

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

func (c *FiberContext) Cookie(name string) (string, error)

func (*FiberContext) Ctx added in v0.2.8

func (c *FiberContext) Ctx() any

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, defaultValue ...string) string

func (*FiberContext) Header

func (c *FiberContext) Header(key, value string)

func (*FiberContext) JSON

func (c *FiberContext) JSON(statusCode int, data any) error

func (*FiberContext) JSONP

func (c *FiberContext) JSONP(code int, data any) error

func (*FiberContext) Method

func (c *FiberContext) Method() string

func (*FiberContext) Params

func (c *FiberContext) Params(key string, undefined ...string) string

func (*FiberContext) Path

func (c *FiberContext) Path() string

func (*FiberContext) Query

func (c *FiberContext) Query(key string, undefined ...string) string

func (*FiberContext) Redirect

func (c *FiberContext) Redirect(code int, location string) error

func (*FiberContext) Render

func (c *FiberContext) Render(name string, bind interface{}, layouts ...string) error

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)

func (*FiberContext) SetCookie

func (c *FiberContext) SetCookie(cookie *http.Cookie)

func (*FiberContext) ShouldBind

func (c *FiberContext) ShouldBind(obj any) error

func (*FiberContext) ShouldBindNotImplemented

func (c *FiberContext) ShouldBindNotImplemented() bool

func (*FiberContext) Status

func (c *FiberContext) Status(statusCode int)

func (*FiberContext) TOML

func (c *FiberContext) TOML(code int, obj any) error

func (*FiberContext) Validate

func (c *FiberContext) Validate(obj any) error

func (*FiberContext) Write

func (c *FiberContext) Write(p []byte) (int, error)

func (*FiberContext) XML

func (c *FiberContext) XML(code int, content any) error

func (*FiberContext) YAML

func (c *FiberContext) YAML(code int, obj any) error

type FiberMux

type FiberMux struct {
	// contains filtered or unexported fields
}

func Default

func Default() *FiberMux

Default 默认的fiber.app,已做好基本的参数配置

func NewWrapper

func NewWrapper(app *fiber.App) *FiberMux

NewWrapper 创建App实例

func (*FiberMux) AcquireCtx

func (m *FiberMux) AcquireCtx(c *fiber.Ctx) *FiberContext

func (*FiberMux) App

func (m *FiberMux) App() *fiber.App

func (*FiberMux) BindRoute

func (m *FiberMux) BindRoute(method, path string, handler fastapi.MuxHandler) error

func (*FiberMux) Listen

func (m *FiberMux) Listen(addr string) error

func (*FiberMux) ReleaseCtx

func (m *FiberMux) ReleaseCtx(c *FiberContext)

func (*FiberMux) ShutdownWithTimeout

func (m *FiberMux) ShutdownWithTimeout(timeout time.Duration) error

Jump to

Keyboard shortcuts

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