g

package
v0.0.0-...-6e4d488 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	ConfigFileName = "config.yaml"     // 配置文件名称
	CasbinFileName = "rbac_model.conf" // casbin 规则文件名称
)

Variables

View Source
var (
	NoErr         = ErrMsg{0, "请求成功"}
	NeedInitErr   = ErrMsg{2001, "初始化数据库"}
	AuthErr       = ErrMsg{4001, "认证错误"}
	AuthExpireErr = ErrMsg{4002, "token 过期,请刷新token"}
	AuthActionErr = ErrMsg{4003, "权限错误"}
	ParamErr      = ErrMsg{4004, "参数解析失败"}
	SystemErr     = ErrMsg{5000, "系统错误"}
	DataEmptyErr  = ErrMsg{5001, "数据为空"}
	TokenCacheErr = ErrMsg{5002, "TOKEN CACHE 错误"}
	MobileErr     = ErrMsg{4009, "手机号被注册"}

	ErrParamValidate = errors.New("参数验证失败")
	ErrPaginateParam = errors.New("分页查询参数缺失")
)
View Source
var (
	CONFIG     config.Config         // 配置
	ZAPLOG     *zap.Logger           // 日志
	VIPER      *viper.Viper          // viper
	CACHE      redis.UniversalClient // 缓存
	PermRoutes []map[string]string   // 权限路由
)

Functions

This section is empty.

Types

type ErrMsg

type ErrMsg struct {
	Code int64  `json:"code"`
	Msg  string `json:"message"`
}

ErrMsg

type Model

type Model struct {
	Id        uint   `json:"id"`
	UpdatedAt string `json:"updatedAt"`
	CreatedAt string `json:"createdAt"`
}

Model

type Paginate

type Paginate struct {
	Page     int    `json:"page"`
	PageSize int    `json:"pageSize"`
	OrderBy  string `json:"orderBy"`
	Sort     string `json:"sort"`
}

Paginate 验证请求参数

func (*Paginate) PaginateScope

func (req *Paginate) PaginateScope() func(db *gorm.DB) *gorm.DB

PaginateScope 分页 scope

func (*Paginate) Request

func (req *Paginate) Request(ctx iris.Context) error

type ReqId

type ReqId struct {
	Id uint `json:"id" param:"id"`
}

ReqId 获取id请求参数

func (*ReqId) Request

func (req *ReqId) Request(ctx iris.Context) error

type Response

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

Response

Jump to

Keyboard shortcuts

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