app

package
v0.0.0-...-8170b65 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindAndValid

func BindAndValid(c *gin.Context, form interface{}) (int, int, string)

BindAndValid binds and validates data

func BindAndValidate

func BindAndValidate(c *gin.Context, form interface{}) error

func GetParams

func GetParams(c *gin.Context) dto.BasePage

func MarkErrors

func MarkErrors(errs []*validation.Error) error

MarkErrors logs error logs

Types

type BaseResponse

type BaseResponse struct {
	Code int    `json:"status"` // 状态码
	Msg  string `json:"msg"`    // 提示信息
}

type Gin

type Gin struct {
	C *gin.Context
}

func (*Gin) Response

func (g *Gin) Response(httpCode int, errCode interface{}, data interface{})

Response setting gin.JSON

func (*Gin) ResponsePage

func (g *Gin) ResponsePage(httpCode int, errCode interface{}, data interface{}, total, totalPage int)

Response setting gin.JSON

type Response

type Response struct {
	Code int         `json:"status"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type ResponsePage

type ResponsePage struct {
	Code      int         `json:"status"`
	Msg       string      `json:"msg"`
	Data      interface{} `json:"data"`
	Total     int         `json:"total"`
	TotalPage int         `json:"totalPage"`
}

Jump to

Keyboard shortcuts

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