gcontext

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GEContext

type GEContext struct {
	context.Context
	Gin  *gin.Context
	Cron *context2.Context
}

请求上下文

func (*GEContext) AnyParam

func (geCtx *GEContext) AnyParam(key string) (value string)

二次封装gin的取参方法, 会依次从POST, GET, URI 取参

func (*GEContext) DefaultAnyParam

func (geCtx *GEContext) DefaultAnyParam(key string, defaultValue string) (value string)

二次封装gin的取参方法, 支持传入默认值 取不到会返回默认值

func (*GEContext) GetCronParam

func (ctx *GEContext) GetCronParam() (params []string)

GetCronParam 获取定时任务参数

func (*GEContext) JSON

func (geCtx *GEContext) JSON(code int, obj interface{})

二次封装gin的json返回方法

func (*GEContext) String

func (geCtx *GEContext) String(code int, format string, values ...interface{})

二次封装gin的string返回方法

type GEForkedContext

type GEForkedContext struct {
	context.Context
}

派生上下文, 保障框架的并发安全问题

func WithGEForkedContext

func WithGEForkedContext(parent context.Context) (ctx *GEForkedContext)

派生协程使用GEContext之前必须调用该方法获取一个派生的context

func (*GEForkedContext) Value

func (ctx *GEForkedContext) Value(key interface{}) (value interface{})

type GEHandleFunc

type GEHandleFunc func(c *GEContext)

controller定义

Jump to

Keyboard shortcuts

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