Documentation ¶
Index ¶
- Variables
- func Create(db *gorm.DB, cud CUDFunc) (uint, error)
- func Delete(db *gorm.DB, cud CUDFunc, scopes ...func(db *gorm.DB) *gorm.DB) error
- func Find(db *gorm.DB, prf PageResponseFunc, scopes ...func(db *gorm.DB) *gorm.DB) error
- func First(db *gorm.DB, rf ResponseFunc, scopes ...func(db *gorm.DB) *gorm.DB) error
- func Pagination(db *gorm.DB, prf PageResponseFunc, pageScope func(db *gorm.DB) *gorm.DB, ...) (int64, error)
- func Update(db *gorm.DB, id uint, cud CUDFunc) error
- type CUDFunc
- type ErrMsg
- type Model
- type PageResponseFunc
- type Paginate
- type ReqId
- type Response
- type ResponseFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( NoErr = ErrMsg{2000, "请求成功"} 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 错误"} ErrParamValidate = errors.New("参数验证失败") ErrPaginateParam = errors.New("分页查询参数缺失") )
Functions ¶
Types ¶
type CUDFunc ¶
type CUDFunc interface { Create(db *gorm.DB) (uint, error) Update(db *gorm.DB, scopes ...func(db *gorm.DB) *gorm.DB) error Delete(db *gorm.DB, scopes ...func(db *gorm.DB) *gorm.DB) error }
CUDFunc 增改删接口
type Model ¶
type Model struct { Id uint `json:"id" uri:"id" form:"id" param:"id"` UpdatedAt string `json:"updatedAt" uri:"updatedAt" form:"updatedAt" param:"updatedAt"` CreatedAt string `json:"createdAt" uri:"createdAt" form:"createdAt" param:"createdAt"` }
Model
type PageResponseFunc ¶
type PageResponseFunc interface { Paginate(db *gorm.DB, pageScope func(db *gorm.DB) *gorm.DB, scopes ...func(db *gorm.DB) *gorm.DB) (int64, error) Find(db *gorm.DB, scopes ...func(db *gorm.DB) *gorm.DB) error }
PageResponseFunc 分页接口
type Paginate ¶
type Paginate struct { Page int `json:"page" form:"page"` PageSize int `json:"pageSize" form:"pageSize"` OrderBy string `json:"orderBy" form:"orderBy"` Sort string `json:"sort" form:"sort"` }
Paginate 验证请求参数
func (*Paginate) PaginateScope ¶
PaginateScope 分页 scope
Click to show internal directories.
Click to hide internal directories.