app

package
v0.0.0-...-61dbfe3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TranslateApp = &Translate{}

定义一个全局翻译器TranslateApp

Functions

func BindAndValid

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

BindAndValid binds and validates data

func Errorf

func Errorf(status, code int, msg string, v ...interface{}) error

Errorf Errorf

func InitTrans

func InitTrans(locale string) (err error)

InitTrans 初始化翻译器(Initialize the trans component)

Types

type Gin

type Gin struct {
	C *gin.Context
}

Gin struct

func (*Gin) Resp

func (g *Gin) Resp(msg string)

github.com/go-playground/validator/v10 @param msg:表单验证失败信息(国际化) Resp 响应:validator表单验证失败信息

func (*Gin) Response

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

Response 响应业务结果集

type Response

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

返回的对象

type Translate

type Translate struct {
	Trans ut.Translator
	Valid *validator.Validate
}

Jump to

Keyboard shortcuts

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