gin

package
v0.0.0-...-6667eb6 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogPostBody

func LogPostBody() gin.HandlerFunc

LogPostBody gin log插件 打印POST PUT请求json参数

func Logger

func Logger() gin.HandlerFunc

Logger gin log插件

func Prof

func Prof(r *gin.Engine)

Prof used in gin

func Recover

func Recover() gin.HandlerFunc

Recover gin panic recover插件

func ResponseWrapper

func ResponseWrapper(handle APIHandler) gin.HandlerFunc

ResponseWrapper

Types

type APIHandler

type APIHandler func(ctx *gin.Context) *JSONResponse

APIHandler gin router回调函数 handler函数定义格式

type JSONResponse

type JSONResponse struct {
	Code int         `json:"errcode"`
	Msg  string      `json:"errmsg,omitempty"`
	Data interface{} `json:"data,omitempty"`
}

JSONResponse 返回结构

func ErrorResponse

func ErrorResponse(code int, msg string) *JSONResponse

ErrorResponse 错误返回

func SuccessResponse

func SuccessResponse(data interface{}) *JSONResponse

SuccessResponse 正确返回

Jump to

Keyboard shortcuts

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