Back to

Package httper

Latest Go to latest

The highest tagged major version is .

Published: Oct 5, 2019 | License: BSD-3-Clause | Module:


func BindAndCheck

func BindAndCheck(ctx *gin.Context, data interface{}) bool

BindAndCheck 绑定参数并验证参数 true: 确实存在问题,会返回400错误 false: 不存在问题,验证通过

func HandleResponse

func HandleResponse(c *gin.Context, err error, data interface{})

HandleResponse 统一处理异常,统一处理日志,统一处理返回

func SendFailResp

func SendFailResp(c *gin.Context, httpCode int, message string)

SendFailResp 返回失败请求

func SendResp

func SendResp(c *gin.Context, httpCode, code int, message string, data interface{})

SendResp 返回自定义数据

func SendSuccessResp

func SendSuccessResp(c *gin.Context, message string, data interface{})

SendSuccessResp 返回成功请求

type Response

type Response struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`

Response 通用返回模型

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier