handler

package
v0.0.0-...-a864060 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BingFormParameter

func BingFormParameter(c *gin.Context)

* form 表单请求参数,用ShouldBind方法bind到struct对象

func FormPostParameter

func FormPostParameter(c *gin.Context)

* 获取form表单提交的参数 用PostMan 测试的时候不能参数不能放在 params 中,应该放在body中作为参数传过来 否则无法接受到参数

// todo PostForm 这种参数swagger无法传参数

@Description 获取form表单提交的参数 @Param name query string true "名称" @Param password query string true "密码" @Success 200 {string} json "{"code":200,"data":{},"msg":"ok"}" @Router /test/form_post [post]

func GenQrCode

func GenQrCode(c *gin.Context)

* 生成二维 浏览器访问 http://localhost:8088/test/genQrCode?value=234

func GetUserById

func GetUserById(c *gin.Context)

* 测试获取restFul 参数 http://localhost:8080/test/getuser/1345

@Summary test @Param id path int true "id" @Success 200 {string} json "{"code":200,"data":{},"msg":"ok"}" @Router /test/getuser/{id} [get]

func JsonParameter

func JsonParameter(c *gin.Context)

* JSON 请求参数,用ShouldBindJSON方法bing到struct对象

func QueryStrParameter

func QueryStrParameter(c *gin.Context)

* 获取?后面的参数 http://localhost:8080/test/queryStrParameter?firstname=123&lastname=ggg DefaultQuery 方法如果获取不到参数则返回默认值,如下地址则 firstName 的值将为 akka http://localhost:8080/test/queryStrParameter?lastname=ggg

func Uploadfile

func Uploadfile(c *gin.Context)

* 上传文件测试

Types

type UserLogin

type UserLogin struct {
	Name    string `json:"name" form:"name" binding:"required"`
	Address string `json:"address" form:"address" binding:"required"`
}

Jump to

Keyboard shortcuts

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