Documentation ¶
Index ¶
- Constants
- Variables
- func CheckHeaderParams(name string, v *string, ctx *app.RequestContext) bool
- func CheckHeaderParamsWithErrorMsg(name string, v *string, errorMsg string, ctx *app.RequestContext) bool
- func CheckParamsWithErrorMsg(name string, str string, v *string, errorMsg string, ctx *app.RequestContext) bool
- func CheckPostFormParams(name string, v *string, ctx *app.RequestContext) bool
- func CheckPostFormParamsWithErrorMsg(name string, v *string, errorMsg string, ctx *app.RequestContext) bool
- func CheckQueryParams(name string, v *string, ctx *app.RequestContext) bool
- func CheckQueryParamsWithErrorMsg(name string, v *string, errorMsg string, ctx *app.RequestContext) bool
- func ClearCookie(ctx *app.RequestContext, domain string, path string, keys ...string)
- func GetCookie(name string, ctx *app.RequestContext) string
- func GetHeader(ctx *app.RequestContext, key string) string
- func NewServer(options gServer.Options, routerProvider func(engine *server.Hertz), ...) gServer.Server
- func PostFormArray(ctx *app.RequestContext, name string) []string
- func QueryArray(ctx *app.RequestContext, name string) []string
- func SetCookie(c cookie.Cookie, ctx *app.RequestContext)
- func ShouldBind(ctx *app.RequestContext, obj any) error
- type Server
Constants ¶
View Source
const ( CookieDeleteMe = "DeleteMe" CookieDeleteMaxAge = 0 CookieDeleteVal = "" )
Variables ¶
Functions ¶
func CheckHeaderParams ¶
func CheckHeaderParams(name string, v *string, ctx *app.RequestContext) bool
func CheckParamsWithErrorMsg ¶
func CheckPostFormParams ¶
func CheckPostFormParams(name string, v *string, ctx *app.RequestContext) bool
func CheckQueryParams ¶
func CheckQueryParams(name string, v *string, ctx *app.RequestContext) bool
func ClearCookie ¶
func ClearCookie(ctx *app.RequestContext, domain string, path string, keys ...string)
del cookie if len(keys)==0 this function will delete all cookies
func PostFormArray ¶
func PostFormArray(ctx *app.RequestContext, name string) []string
func QueryArray ¶
func QueryArray(ctx *app.RequestContext, name string) []string
func ShouldBind ¶
func ShouldBind(ctx *app.RequestContext, obj any) error
tag名称及使用方法 path 绑定 url 上的路径参数,相当于 hertz 路由{:param}或{*param}中拿到的参数。例如:如果定义的路由为:/v:version/example,可以把 path 的参数指定为路由参数:path:"version",此时,url: http://127.0.0.1:8888/v1/example,可以绑定path参数"1" form 绑定请求的 body 内容。content-type -> multipart/form-data 或 application/x-www-form-urlencoded,绑定 form 的 key-value query 绑定请求的 query 参数 cookie 绑定请求的 cookie 参数 header 绑定请求的 header 参数 json 绑定请求的 body 内容 content-type -> application/json,绑定 json 参数 raw_body 绑定请求的原始 body(bytes),绑定的字段名不指定,也能绑定参数。(注:raw_body 绑定优先级最低,当指定多个 tag 时,一旦其他 tag 成功绑定参数,则不会绑定 body 内容。) 参数绑定优先级 path > form > query > cookie > header > json > raw_body
Types ¶
Click to show internal directories.
Click to hide internal directories.