urlutil

package module
v0.0.0-...-9850c2a Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: GPL-3.0 Imports: 14 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAttrib

func AddAttrib(r *http.Request, name string, value string)

*

  • 增加请求属性
  • r http请求对象
  • name 属性名
  • value 属性值

func AllParams

func AllParams(r *http.Request, entity interface{}) (map[string][]string, map[string]string, map[string][]string)

*

  • 取所有参数,并转换成对应实体属性类型(map[string]interface{})
  • @param ctx gin请求上下文
  • @param entity 实体对象
  • @return map[string]interface{}

func Filter

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

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

func GetAttrib

func GetAttrib(r *http.Request, name string) string

*

  • 获取请求属性
  • r http请求对象
  • name 属性名
  • value 属性值

func GetBody

func GetBody(r *http.Request, entity interface{}) *emity.MsgEmity

*

  • 取参数
  • r http请求对象
  • entity 要转换的数据类型 无视(&entity或entity)

func GetEntity

func GetEntity(r *http.Request, entity interface{}) *emity.MsgEmity

*

  • 取参数
  • r http请求对象
  • entity 要转换的数据类型 必须是指针

func GetHeader

func GetHeader(r *http.Request) map[string]string

取头参数

func GetHearParam

func GetHearParam(r *http.Request, name string, def interface{}) interface{}

*

  • 取请求头参数
  • r http请求对象
  • name 参数名称
  • def 默认值

func GetParam

func GetParam(r *http.Request, name string, def interface{}) interface{}

*

  • 取参数
  • r http请求对象
  • name 参数名称
  • def 默认值

func GetParamToId

func GetParamToId(r *http.Request, idName string) interface{}

*

  • 取请求参数中的记录编号
  • r http请求对象
  • idName 主键名称

func GetParamToVersion

func GetParamToVersion(r *http.Request, hasVersion bool, versionName string) int

*

  • 取请求参数中的版本号
  • r http请求对象
  • hasVersion (数据库表)是否有版本号

func GetParams

func GetParams(r *http.Request, entity interface{}) *emity.MsgEmity

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

func GetParamsAll

func GetParamsAll(r *http.Request, addHeader bool) map[string]interface{}

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

func SetResponse

func SetResponse(w http.ResponseWriter, me *emity.MsgEmity)

*

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

func SetupCORS

func SetupCORS(w http.ResponseWriter)

*

  • 允许跨域访问
  • w Http响应对象

Types

This section is empty.

Jump to

Keyboard shortcuts

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