Documentation ¶
Index ¶
- Constants
- func DbFilter(db *gorm.DB, query []Condition) *gorm.DB
- type ArticleCondition
- type Captcha
- type CaptchaEmail
- type CaptchaVerify
- type ChangePasswordReq
- type Condition
- type Context
- type EmptyRequest
- type GetByID
- type IDsReq
- type OauthLoginReq
- type Order
- type PageInfo
- type ResetPasswordReq
- type UpdateRoleMenus
- type UpdateRoleResources
- type UpdateUserRoles
- type User
- type UserEmail
Constants ¶
View Source
const ( QueryLike = "LIKE" QueryPrefixLike = "PREFIX LIKE" QueryNotLike = "NOT LIKE" QueryEqual = "=" QueryIn = "IN" QueryAND = "AND" BiggerOrQueryAND = "<=" SmallerOrQueryAND = ">=" QueryIsNull = "IS NULL" QueryIsNotNull = "IS NOT NULL" )
View Source
const ( OrderAsc = "asc" OrderDesc = "desc" )
View Source
const ( StateNormal = -1 StateDeleted = 1 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArticleCondition ¶
type Captcha ¶
type Captcha struct { CaptchaType string `json:"captcha_type"` Height int `json:"height"` // Height png height in pixel. Width int `json:"width"` // Width Captcha png width in pixel. Length int `json:"length"` // DefaultLen Default number of digits in captcha solution. }
验证码生成
type CaptchaEmail ¶
type CaptchaEmail struct { Email string `json:"email"` // 目标邮箱 Service string `json:"service"` // 服务 Check bool `json:"check"` // 是否检查邮箱是否存在 }
func (*CaptchaEmail) IsValid ¶
func (req *CaptchaEmail) IsValid() error
type CaptchaVerify ¶
验证码验证请求
type ChangePasswordReq ¶
type ChangePasswordReq struct { ID int `json:"-"` // 从 JWT 中提取 user id,避免越权 Password string `json:"password"` // 旧密码 NewPassword string `json:"newPassword"` // 新密码 }
Modify password structure
type Condition ¶
type Condition struct { Flag string `json:"flag"` // 标识 and、or,默认and Field string `json:"field"` // 表字段 Rule string `json:"rule"` // 规则 =、like、in Value interface{} `json:"value"` // 值 }
字段,关键字,匹配规则
type Context ¶
type Context struct { context.Context `json:"-" header:"-"` Token string `json:"token" header:"token" example:""` UID int `json:"uid" header:"-" example:""` Username string `json:"username" header:"-" example:""` Ip string `json:"ip" header:"-" example:""` IpSource string `json:"ip_source" header:"-" example:""` }
请求上下文,一般存放请求头参数
func (*Context) GetContext ¶
type EmptyRequest ¶
type EmptyRequest struct { }
type GetByID ¶
type GetByID struct {
ID int `json:"id" form:"id"` // 主键ID
}
GetByID Find by id structure
type OauthLoginReq ¶
type PageInfo ¶
type PageInfo struct { Page int `json:"page" form:"page"` // 页码 PageSize int `json:"page_size" form:"page_size"` // 每页大小 Order string `json:"order" form:"order"` // 排序关键词 OrderKey string `json:"order_key" form:"order_key"` // 排序 asc|desc Orders []*Order `json:"orders" form:"orders"` // 排序 Conditions []*Condition `json:"conditions" form:"conditions"` // 使用条件语句查询 }
PageInfo Paging common input parameter structure
type ResetPasswordReq ¶
type UpdateRoleMenus ¶
type UpdateRoleResources ¶
type UpdateUserRoles ¶
type User ¶
type User struct { Username string `json:"username" from:"username" example:"admin@qq.com"` Password string `json:"password" from:"password" example:"123456"` Code string `json:"code" from:"code" example:""` LoginType string `json:"-" from:"-" example:""` // 登录类型 Avatar string `json:"-" from:"-" example:""` // 头像 }
Click to show internal directories.
Click to hide internal directories.