request

package
v0.0.0-...-70261f9 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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

func DbFilter

func DbFilter(db *gorm.DB, query []Condition) *gorm.DB

* 查询过滤条件

Types

type ArticleCondition

type ArticleCondition struct {
	TagID      int `json:"tag_id"`      // 文章标签ID
	CategoryID int `json:"category_id"` // 文章分类ID
}

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 CaptchaVerify struct {
	ID   string `json:"id"`
	Code string `json:"code"`
}

验证码验证请求

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

func (s *Context) GetContext() context.Context

type EmptyRequest

type EmptyRequest struct {
}

type GetByID

type GetByID struct {
	ID int `json:"id" form:"id"` // 主键ID
}

GetByID Find by id structure

type IDsReq

type IDsReq struct {
	IDs []int `json:"ids" form:"ids"`
}

type OauthLoginReq

type OauthLoginReq struct {
	Platform string `json:"platform" example:""` // 平台
	Code     string `json:"code" example:""`     // 授权码
	State    string `json:"state" example:""`    // 状态
}

type Order

type Order struct {
	Field string `json:"field"` // 表字段
	Rule  string `json:"rule"`  // 排序规则 asc|desc
}

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

func (*PageInfo) Limit

func (page *PageInfo) Limit() int

func (*PageInfo) Offset

func (page *PageInfo) Offset() int

func (*PageInfo) OrderClause

func (page *PageInfo) OrderClause() string

排序语句

func (*PageInfo) WhereClause

func (page *PageInfo) WhereClause() (string, []interface{})

条件语句

type ResetPasswordReq

type ResetPasswordReq 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:""`
}

type UpdateRoleMenus

type UpdateRoleMenus struct {
	RoleId  int   `json:"role_id"`
	MenuIds []int `json:"menu_ids"`
}

type UpdateRoleResources

type UpdateRoleResources struct {
	RoleId      int   `json:"role_id"`
	ResourceIds []int `json:"resource_ids"`
}

type UpdateUserRoles

type UpdateUserRoles struct {
	UserId  int   `json:"user_id"`
	RoleIds []int `json:"role_ids"`
}

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:""` // 头像
}

func (User) IsValid

func (m User) IsValid() error

type UserEmail

type UserEmail struct {
	Username string `json:"username" from:"username" example:"admin@qq.com"`
}

用户名只能是邮箱

func (UserEmail) IsValid

func (m UserEmail) IsValid() error

Jump to

Keyboard shortcuts

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