gin

package module
v0.0.0-...-c6b51d4 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: GPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGin

func GetGin(ginMode, webRoot string, InterceptorFunc func(ctx *gin.Context) bool, shutdown func(ctx *gin.Context)) *gin.Engine

Types

type GinUtil

type GinUtil struct{}

func (GinUtil) ControllerRegister

func (gu GinUtil) ControllerRegister(url string, handler func(ctx *gin.Context) interface{}, iTypes ...RequestType)

注册web接口

func (GinUtil) Cors

func (gu GinUtil) Cors() gin.HandlerFunc

跨域函数

func (GinUtil) GetController

func (gu GinUtil) GetController() map[string]HttpHandleInfo

取注册的web接口

func (GinUtil) GetHandleFunc

func (gu GinUtil) GetHandleFunc(urlKey string, iType RequestType, InterceptorFunc func(ctx *gin.Context) bool,
	controllerMap map[string]HttpHandleInfo) func(ctx *gin.Context)

取注册的web接口

func (GinUtil) RegisterController

func (gu GinUtil) RegisterController(url string, iTypes interface{}, handler func(ctx *gin.Context) interface{})

注册web接口

func (GinUtil) RegisterControllers

func (gu GinUtil) RegisterControllers(url string, iTypes interface{}, handler func(ctx *gin.Context) interface{})

注册web接口

func (GinUtil) SetCors

func (gu GinUtil) SetCors(r *gin.Engine)

设置跨域

func (GinUtil) SetStatic

func (gu GinUtil) SetStatic(r *gin.Engine, webroot string)

设置静态路径

type HttpHandleInfo

type HttpHandleInfo struct {
	Url  string
	Type RequestType
	Fun  func(ctx *gin.Context) interface{}
}

http控制层接口信息

type RequestType

type RequestType string

请求类型枚举

const (
	GET     RequestType = "GET"
	POST    RequestType = "POST"
	DELETE  RequestType = "DELETE"
	PUT     RequestType = "PUT"
	OPTIONS RequestType = "OPTIONS"
)

func (RequestType) String

func (rt RequestType) String() string

枚举转字符串

Jump to

Keyboard shortcuts

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