binding

package
v0.0.0-...-961a225 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindForm

func BindForm(req *http.Request, target interface{}) error

BindForm 函数用于将 HTTP 请求中的表单数据绑定到指定的目标对象上。 参数:

  • req:包含表单数据的 http.Request 对象。
  • target:目标对象的指针,表单数据将被绑定到该对象上。

返回值:

  • error:如果在绑定过程中发生错误,返回相应的错误信息;否则返回 nil。

func BindQuery

func BindQuery(vars url.Values, target interface{}) error

BindQuery 函数用于将 URL 中的查询参数绑定到指定的目标对象上。 参数:

  • vars:包含查询参数的 url.Values 对象。
  • target:目标对象的指针,查询参数将被绑定到该对象上。

返回值:

  • error:如果在绑定过程中发生错误,返回相应的错误信息;否则返回 nil。

func EncodeURL

func EncodeURL(pathTemplate string, msg interface{}, needQuery bool) string

EncodeURL 将 proto 消息编码为 URL 路径。 pathTemplate 是路径模板,msg 是要编码的 proto 消息,needQuery 表示是否需要将剩余的查询参数附加到 URL 中。

Types

This section is empty.

Jump to

Keyboard shortcuts

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