gcontext

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: Apache-2.0 Imports: 5 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) GetLoginID added in v0.1.11

func (geCtx *GEContext) GetLoginID() (userID int64, err error)

func (*GEContext) JSON

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

二次封装gin的json返回方法

func (*GEContext) ParamArrayInt added in v0.1.4

func (geCtx *GEContext) ParamArrayInt(key string) (vals []int, err error)

func (*GEContext) ParamArrayInt64 added in v0.1.4

func (geCtx *GEContext) ParamArrayInt64(key string) (vals []int64, err error)

func (*GEContext) ParamBool added in v0.1.3

func (geCtx *GEContext) ParamBool(key string) (value bool, err error)

func (*GEContext) ParamBoolDefault added in v0.1.3

func (geCtx *GEContext) ParamBoolDefault(key string, def bool) (value bool, err error)

func (*GEContext) ParamInt added in v0.1.2

func (geCtx *GEContext) ParamInt(key string) (value int, err error)

func (*GEContext) ParamInt64 added in v0.1.2

func (geCtx *GEContext) ParamInt64(key string) (value int64, err error)

func (*GEContext) ParamInt64Default added in v0.1.3

func (geCtx *GEContext) ParamInt64Default(key string, def int64) (value int64, err error)

func (*GEContext) ParamIntDefault added in v0.1.3

func (geCtx *GEContext) ParamIntDefault(key string, def int) (value int, err error)

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