igin

package
v1.1.37 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Mode = gin.Mode
)

Functions

func DisableConsoleColor added in v1.0.5

func DisableConsoleColor()

func LoggerWithFormatter added in v1.0.5

func LoggerWithFormatter(fn func(params LogFormatterParams) string) gin.HandlerFunc

LoggerWithFormatter 封装 gin.LoggerWithFormatter

func SetLogFile added in v1.0.8

func SetLogFile(filePath string) error

func SetMode added in v1.0.5

func SetMode(value string)

Types

type Engine

type Engine struct {
	*gin.Engine
}

func NewGinEngine

func NewGinEngine() Engine

func (*Engine) Run

func (ge *Engine) Run(addr string) error

type GinRouterAdapter

type GinRouterAdapter struct {
	*gin.Engine
}

func NewGinRouter added in v1.1.24

func NewGinRouter() *GinRouterAdapter

NewGinRouter 创建并返回一个新的GinRouterAdapter实例,封装了*gin.Engine

func (*GinRouterAdapter) DELETE

func (gra *GinRouterAdapter) DELETE(relativePath string, handlers ...HandlerFunc)

func (*GinRouterAdapter) GET

func (gra *GinRouterAdapter) GET(relativePath string, handlers ...HandlerFunc)

func (*GinRouterAdapter) Group

func (gra *GinRouterAdapter) Group(relativePath string, handlers ...HandlerFunc) IRouterGroup

func (*GinRouterAdapter) POST

func (gra *GinRouterAdapter) POST(relativePath string, handlers ...HandlerFunc)

func (*GinRouterAdapter) PUT

func (gra *GinRouterAdapter) PUT(relativePath string, handlers ...HandlerFunc)

func (*GinRouterAdapter) Static

func (gra *GinRouterAdapter) Static(relativePath, rootPath string)

type GinRouterGroupAdapter

type GinRouterGroupAdapter struct {
	*gin.RouterGroup
}

func (*GinRouterGroupAdapter) DELETE

func (grga *GinRouterGroupAdapter) DELETE(relativePath string, handlers ...HandlerFunc)

func (*GinRouterGroupAdapter) GET

func (grga *GinRouterGroupAdapter) GET(relativePath string, handlers ...HandlerFunc)

func (*GinRouterGroupAdapter) Group

func (grga *GinRouterGroupAdapter) Group(relativePath string, handlers ...HandlerFunc) IRouterGroup

func (*GinRouterGroupAdapter) POST

func (grga *GinRouterGroupAdapter) POST(relativePath string, handlers ...HandlerFunc)

func (*GinRouterGroupAdapter) PUT

func (grga *GinRouterGroupAdapter) PUT(relativePath string, handlers ...HandlerFunc)

type HandlerFunc

type HandlerFunc func(c IContext)

type IContext

type IContext interface {
	ClientIP() (values string)
	QueryArray(key string) (values []string)
	JSON(code int, obj any)
	Param(key string) string
	BindJSON(v interface{}) error
	ShouldBind(v interface{}) error
	ShouldBindJSON(v interface{}) error
	ShouldBindQuery(v interface{}) error
	Get(key string) (value interface{}, exists bool)
	Set(key string, value interface{})
	Next()
	Request() *http.Request
	Writer() gin.ResponseWriter
	FullPath() string
	GetHeader(key string) string
	Query(key string) string
	Abort()
	Header(key, value string)
	Data(code int, contentType string, data []byte)
	String(code int, format string, values ...any)
	GetInt64(key string) int64
	FormFile(formName string) (*multipart.FileHeader, error)
	SaveUploadedFile(file *multipart.FileHeader, dst string) error
}

type IRouter

type IRouter interface {
	GET(relativePath string, handlers ...HandlerFunc)
	POST(relativePath string, handlers ...HandlerFunc)
	PUT(relativePath string, handlers ...HandlerFunc)
	DELETE(relativePath string, handlers ...HandlerFunc)
	Group(relativePath string, handlers ...HandlerFunc) IRouterGroup
	Static(relativePath, rootPath string)
}

type IRouterGroup

type IRouterGroup interface {
	GET(relativePath string, handlers ...HandlerFunc)
	POST(relativePath string, handlers ...HandlerFunc)
	PUT(relativePath string, handlers ...HandlerFunc)
	DELETE(relativePath string, handlers ...HandlerFunc)
	Group(relativePath string, handlers ...HandlerFunc) IRouterGroup
}

func NewGinRouterGroup added in v1.1.24

func NewGinRouterGroup() IRouterGroup

type LogFormatterParams added in v1.0.5

type LogFormatterParams struct {
	gin.LogFormatterParams
}

LogFormatterParams 封装 gin.LogFormatterParams

Jump to

Keyboard shortcuts

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