api

package
v0.0.0-...-2a1fef4 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

context 跟gin.context 的转换

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKeyValues

func GetKeyValues(ctx context.Context) map[string][]string

func NewAPIFunc

func NewAPIFunc(c *gin.Context) interface{}

NewAPIFunc default of custom handlefunc

Types

type Context

type Context struct {
	context.Context
}

Context Wrapping gin context to custom context

func NewCtx

func NewCtx(c *gin.Context) *Context

NewCtx Create a new custom context

func (*Context) AddHeadToCtx

func (c *Context) AddHeadToCtx(kv ...string)

AddHeadToCtx 添加一层数据到ctx里面

func (*Context) GetGinCtx

func (c *Context) GetGinCtx() *gin.Context

GetGinCtx 获取 gin.Context

func (*Context) GetValue

func (c *Context) GetValue(key interface{}) interface{}

GetValue 获取key

func (*Context) GetVersion

func (c *Context) GetVersion() string

GetVersion Get the version by req url

func (*Context) SetValue

func (c *Context) SetValue(key interface{}, value interface{})

SetValue 设置key v

func (*Context) WriteHeadToCtx

func (c *Context) WriteHeadToCtx(g *gin.Context)

WriteHeadToCtx 设置头数据到grpc headre里面

func (*Context) WriteJSON

func (c *Context) WriteJSON(obj interface{})

WriteJSON 写入json对象

Jump to

Keyboard shortcuts

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