general_module

package
v0.0.0-...-8976173 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ok                    = 0
	ErrorBadRequest       = 400001
	ErrorMissToken        = 400002
	ErrorUnauthorized     = 401001
	ErrorForbidden        = 403001
	ErrorNotFound         = 404001
	ErrorMethodNotAllowed = 405001
	ErrorParamsWrong      = 422001
	ErrorSystem           = 500001
	ErrorFileNotFound     = 500002
	ErrorConnectTimeout   = 504001
)

Variables

Functions

func Error

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

func ErrorCode

func ErrorCode(c *gin.Context, code int)

func GetParams

func GetParams(c *gin.Context, params interface{}) error

获取参数以及标签校验

func Success

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

func SuccessCode

func SuccessCode(c *gin.Context, code int)

Types

type HTTPResponse

type HTTPResponse struct {
	Code    int         `json:"code"`
	Message interface{} `json:"message"`
	Data    interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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