ginservice

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GIN_contextEX_Middleware_Key = "__gin_contextEX_Middleware_Key"
)

Variables

This section is empty.

Functions

func DefResJson added in v0.1.2

func DefResJson(code uint32, msg ...any) map[string]any

默认响应Json

func GetContext added in v0.1.8

func GetContext(c *gin.Context) *zservice.Context

获取 gin 携带的上下文

func GinMiddlewareCORS

func GinMiddlewareCORS(zs *zservice.ZService) gin.HandlerFunc

中间件 CORS跨域中间件

func GinMiddlewareContext

func GinMiddlewareContext(zs *zservice.ZService) gin.HandlerFunc

扩展 Context 中间件

func ReadUploadFile

func ReadUploadFile(file *multipart.FileHeader) ([]byte, *zservice.Error)

读取上传的文件信息

func SyncHeader added in v0.1.8

func SyncHeader(c *gin.Context)

同步请求头的 context 信息

Types

type GinService

type GinService struct {
	*zservice.ZService
	Engine *gin.Engine
}

func NewGinService

func NewGinService(c GinServiceConfig) *GinService

gin 服务扩展

type GinServiceConfig

type GinServiceConfig struct {
	Port    int               // 监听端口
	OnStart func(*GinService) // 启动的回调
}

Jump to

Keyboard shortcuts

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