ginWrapper

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: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReleaseCtx added in v0.2.9

func ReleaseCtx(c *GinContext)

Types

type GinContext

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

func AcquireCtx added in v0.2.9

func AcquireCtx(c *gin.Context) *GinContext

func (*GinContext) BindQuery

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

func (*GinContext) BodyParser

func (c *GinContext) BodyParser(model any) error

func (*GinContext) ClientIP

func (c *GinContext) ClientIP() string

func (*GinContext) ContentType added in v0.2.8

func (c *GinContext) ContentType() string

func (*GinContext) Cookie

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

Cookie 解析cookies参数

func (*GinContext) Ctx added in v0.2.8

func (c *GinContext) Ctx() any

func (*GinContext) CustomBindQueryMethod added in v0.2.9

func (c *GinContext) CustomBindQueryMethod() bool

CustomBindQueryMethod 无需自定义实现

func (*GinContext) CustomShouldBindMethod added in v0.2.9

func (c *GinContext) CustomShouldBindMethod() bool

CustomShouldBindMethod 需要自定义实现请求体解析方法

func (*GinContext) File

func (c *GinContext) File(filepath string) error

func (*GinContext) FileAttachment

func (c *GinContext) FileAttachment(filepath, filename string) error

func (*GinContext) Get

func (c *GinContext) Get(key string) (value any, exists bool)

func (*GinContext) GetHeader added in v0.2.9

func (c *GinContext) GetHeader(key string) string

GetHeader 解析请求头参数

func (*GinContext) Header

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

func (*GinContext) JSON

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

func (*GinContext) JSONP

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

func (*GinContext) Method

func (c *GinContext) Method() string

func (*GinContext) Params

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

Params 解析路径参数

func (*GinContext) Path

func (c *GinContext) Path() string

func (*GinContext) Query

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

func (*GinContext) Redirect

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

func (*GinContext) RenderHTML added in v0.2.9

func (c *GinContext) RenderHTML(name string, bind interface{}, layouts ...string) error

func (*GinContext) SendStream

func (c *GinContext) SendStream(stream io.Reader, size ...int) error

func (*GinContext) SendString

func (c *GinContext) SendString(s string) error

func (*GinContext) Set

func (c *GinContext) Set(key string, value any)

func (*GinContext) SetCookie

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

func (*GinContext) ShouldBind

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

func (*GinContext) Status

func (c *GinContext) Status(statusCode int)

func (*GinContext) TOML

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

func (*GinContext) Validate

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

func (*GinContext) Write

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

func (*GinContext) XML

func (c *GinContext) XML(code int, obj any) error

func (*GinContext) YAML

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

type GinMux

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

func Default added in v0.2.9

func Default() *GinMux

func NewWrapper added in v0.2.9

func NewWrapper(app *gin.Engine) *GinMux

NewWrapper 创建App实例

func (*GinMux) App

func (m *GinMux) App() *gin.Engine

func (*GinMux) BindRoute added in v0.2.9

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

func (*GinMux) Listen added in v0.2.9

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

func (*GinMux) ShutdownWithTimeout added in v0.2.9

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

Jump to

Keyboard shortcuts

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