fiberWrapper

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 17 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

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

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

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