gcontext

package
v0.1.42 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 10 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) EventStream added in v0.1.27

func (geCtx *GEContext) EventStream(msg string)

func (*GEContext) EventStreamV2 added in v0.1.28

func (geCtx *GEContext) EventStreamV2(msgChan chan string) (content string)

func (*GEContext) GetCronParam

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

GetCronParam 获取定时任务参数

func (*GEContext) GetLoginExtends added in v0.1.18

func (geCtx *GEContext) GetLoginExtends() (extends string, err error)

func (*GEContext) GetLoginID added in v0.1.11

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

func (*GEContext) GetTokenExtends added in v0.1.22

func (geCtx *GEContext) GetTokenExtends(result interface{}) (err error)

func (*GEContext) JSON

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

二次封装gin的json返回方法

func (*GEContext) JSON_ECHO added in v0.1.26

func (geCtx *GEContext) JSON_ECHO(obj interface{})

func (*GEContext) ParamAny added in v0.1.27

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

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) ParamJson added in v0.1.24

func (geCtx *GEContext) ParamJson(key string, result interface{}) (err error)

func (*GEContext) ParamStringArray added in v0.1.23

func (geCtx *GEContext) ParamStringArray(key, sep string) []string

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