Documentation ¶
Index ¶
- Constants
- Variables
- func MakeCondition(q interface{}) func(db *gorm.DB) *gorm.DB
- func Paginate(pageSize, pageIndex int) func(db *gorm.DB) *gorm.DB
- func ResolveSearchQuery(driver string, q interface{}, condition Condition)
- type Condition
- type GeneralDelDto
- type GeneralGetDto
- type GormCondition
- type GormJoin
- type GormPublic
Constants ¶
View Source
const ( // FromQueryTag tag标记 FromQueryTag = "search" // Mysql 数据库标识 Mysql = "mysql" // Postgres 数据库标识 Postgres = "postgres" )
Variables ¶
View Source
var Driver = "mysql"
Functions ¶
func ResolveSearchQuery ¶
ResolveSearchQuery 解析 *
- exact / iexact 等于
- contains / icontains 包含
- gt / gte 大于 / 大于等于
- lt / lte 小于 / 小于等于
- startswith / istartswith 以…起始
- endswith / iendswith 以…结束
- in
- isnull
- order 排序 e.g. order[key]=desc order[key]=asc
Types ¶
type GeneralDelDto ¶
type GeneralDelDto struct { Id int `uri:"id" json:"id" validate:"required"` Ids []int `json:"ids"` }
func (GeneralDelDto) GetIds ¶
func (g GeneralDelDto) GetIds() []int
type GeneralGetDto ¶
type GeneralGetDto struct {
Id int `uri:"id" json:"id" validate:"required"`
}
type GormCondition ¶
type GormCondition struct { GormPublic Join []*GormJoin }
func (*GormCondition) SetJoinOn ¶
func (e *GormCondition) SetJoinOn(t, on string) Condition
type GormJoin ¶
type GormJoin struct { Type string JoinOn string GormPublic }
type GormPublic ¶
type GormPublic struct { Where map[string][]interface{} Order []string Or map[string][]interface{} }
func (*GormPublic) SetOr ¶
func (e *GormPublic) SetOr(k string, v []interface{})
func (*GormPublic) SetOrder ¶
func (e *GormPublic) SetOrder(k string)
func (*GormPublic) SetWhere ¶
func (e *GormPublic) SetWhere(k string, v []interface{})
Click to show internal directories.
Click to hide internal directories.