app

package
v0.0.0-...-de354b7 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth() gin.HandlerFunc

简单校验

func GetPathParameterInt

func GetPathParameterInt(context *gin.Context, args ...string) (map[string]int, error)

GetPathParameterInt 获取请求路径上的id参数

func GetPathParameterString

func GetPathParameterString(context *gin.Context, args ...string) (map[string]string, error)

func HandleNotFound

func HandleNotFound(c *gin.Context)

func HandleNotMethod

func HandleNotMethod(c *gin.Context)

func InitTrans

func InitTrans(locale string) (err error)

InitTrans 初始化翻译器

func Setup

func Setup()

Types

type GetById

type GetById struct {
	ID int `json:"id" uri:"id"` // 主键ID
}

type Gin

type Gin struct {
	C *gin.Context
}

func (*Gin) Fail

func (g *Gin) Fail(httpCode int, err error, data interface{})

func (*Gin) Success

func (g *Gin) Success(httpCode int, msg string, data interface{})

Response setting gin.JSON

func (*Gin) SuccessExtra

func (g *Gin) SuccessExtra(total int64, page int, pageSize, httpCode int, msg string, data interface{})

type PageInfo

type PageInfo struct {
	Page     int `json:"page" form:"page" binding:"required,gte=1"`         // 页码
	PageSize int `json:"pageSize" form:"pageSize" binding:"required,gte=1"` // 每页大小
}

type Response

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

type ResponseExtra

type ResponseExtra struct {
	Total    int64 `json:"total"`
	Page     int   `json:"page"`
	PageSize int   `json:"pageSize"`
	Response
}

Jump to

Keyboard shortcuts

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