url

package
v0.0.0-...-0090c64 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HttpUtil

type HttpUtil struct{}

func (HttpUtil) DoGet

func (util HttpUtil) DoGet(url string, params map[string]interface{}, hears map[string]string) *MsgEmity

func (HttpUtil) DoPost

func (util HttpUtil) DoPost(url string, params map[string]interface{}, hears map[string]string, isJson ...bool) *MsgEmity

发送POST请求

func (HttpUtil) Get

func (util HttpUtil) Get(url string, jsonParams string) string

func (HttpUtil) Post

func (util HttpUtil) Post(url string, sParams string, isJsonParams bool) string

type HttpsUtil

type HttpsUtil struct{}

func (HttpsUtil) Get

func (this HttpsUtil) Get(urlStr string, params map[string]interface{}, hears map[string]string) *MsgEmity

GET请求

func (HttpsUtil) Post

func (this HttpsUtil) Post(urlStr string, jsonParam string, isJsonParams bool) string

POST请求

type UrlUtil

type UrlUtil struct{}

func (UrlUtil) AddAttrib

func (this UrlUtil) AddAttrib(ctx *gin.Context, name string, value string)

*

  • 增加请求属性
  • ctx GinHttp上下文对象
  • name 属性名
  • value 属性值

func (UrlUtil) AllParams

func (this UrlUtil) AllParams(ctx *gin.Context, entity interface{}) (map[string][]string, map[string]string, map[string][]string)

取所有参数,并转换成对应实体属性类型(map[string]interface{})

func (UrlUtil) Filter

func (this UrlUtil) Filter(data map[string]string, entity interface{}) *MsgEmity

过滤map中不存在结构体中的属性,并转换成对应类型(map[string]interface{})

func (UrlUtil) GetAttrib

func (this UrlUtil) GetAttrib(ctx *gin.Context, name string) string

*

  • 获取请求属性
  • ctx GinHttp上下文对象
  • name 属性名
  • value 属性值

func (UrlUtil) GetBody

func (this UrlUtil) GetBody(ctx *gin.Context, entity interface{}) *MsgEmity

*

  • 取参数
  • ctx GinHttp上下文对象
  • entity 要转换的数据类型 无视(&entity或entity)

func (UrlUtil) GetHeader

func (this UrlUtil) GetHeader(ctx *gin.Context) map[string]string

取头参数

func (UrlUtil) GetHearParam

func (this UrlUtil) GetHearParam(ctx *gin.Context, name string, def interface{}) interface{}

*

  • 取请求头参数
  • ctx GinHttp上下文对象
  • name 参数名称
  • def 默认值

func (UrlUtil) GetParam

func (this UrlUtil) GetParam(ctx *gin.Context, name string, def interface{}) interface{}

*

  • 取参数
  • ctx GinHttp上下文对象
  • name 参数名称
  • def 默认值

func (UrlUtil) GetParamToId

func (this UrlUtil) GetParamToId(ctx *gin.Context, idName string) interface{}

*

  • 取请求参数中的记录编号
  • ctx GinHttp上下文对象
  • idName 主键名称

func (UrlUtil) GetParamToVersion

func (this UrlUtil) GetParamToVersion(ctx *gin.Context, hasVersion bool) int

*

  • 取请求参数中的版本号
  • ctx GinHttp上下文对象
  • hasVersion (数据库表)是否有版本号

func (UrlUtil) GetParams

func (this UrlUtil) GetParams(ctx *gin.Context, entity interface{}) *MsgEmity

取所有参数,并转换成对应实体属性类型(map[string]interface{})

func (UrlUtil) GetParamsAll

func (this UrlUtil) GetParamsAll(ctx *gin.Context, addHeader bool) map[string]interface{}

取所有参数(map[string]interface{})

func (UrlUtil) SetResponse

func (this UrlUtil) SetResponse(ctx *gin.Context, me *MsgEmity)

*

  • 设置统一返回信息
  • w Http响应对象
  • me 统一信息

Jump to

Keyboard shortcuts

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