Documentation ¶
Index ¶
- type Builder
- type Pagination
- type Query
- func (q *Query) ApplyToGorm(g *gorm.DB) (*gorm.DB, error)
- func (q *Query) ApplyToGormCount(g *gorm.DB) (*gorm.DB, error)
- func (q *Query) OrWhereEq(field string, value interface{})
- func (q *Query) OrWhereGt(field string, value interface{})
- func (q *Query) OrWhereGtEq(field string, value interface{})
- func (q *Query) OrWhereIn(field string, value interface{})
- func (q *Query) OrWhereLike(field string, value interface{})
- func (q *Query) OrWhereLt(field string, value interface{})
- func (q *Query) OrWhereLtEq(field string, value interface{})
- func (q *Query) OrWhereNotEq(field string, value interface{})
- func (q *Query) Order(field string, dir SortDir)
- func (q *Query) String() string
- func (q *Query) WhereEq(field string, value interface{})
- func (q *Query) WhereGt(field string, value interface{})
- func (q *Query) WhereGtEq(field string, value interface{})
- func (q *Query) WhereIn(field string, value interface{})
- func (q *Query) WhereLike(field string, value interface{})
- func (q *Query) WhereLt(field string, value interface{})
- func (q *Query) WhereLtEq(field string, value interface{})
- func (q *Query) WhereNotEq(field string, value interface{})
- type Sort
- type SortDir
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { String() string Order(field string, dir SortDir) ApplyToGorm(g *gorm.DB) (*gorm.DB, error) ApplyToGormCount(g *gorm.DB) (*gorm.DB, error) WhereEq(field string, value interface{}) WhereLike(field string, value interface{}) WhereIn(field string, value interface{}) WhereLt(field string, value interface{}) WhereLtEq(field string, value interface{}) WhereGt(field string, value interface{}) WhereGtEq(field string, value interface{}) WhereNotEq(field string, value interface{}) OrWhereEq(field string, value interface{}) OrWhereLike(field string, value interface{}) OrWhereIn(field string, value interface{}) OrWhereLt(field string, value interface{}) OrWhereLtEq(field string, value interface{}) OrWhereGt(field string, value interface{}) OrWhereGtEq(field string, value interface{}) OrWhereNotEq(field string, value interface{}) }
type Pagination ¶
type Pagination struct { Page uint `json:"page"` PageSize uint `json:"page_size"` Total uint `json:"total"` }
func NewPagination ¶
func NewPagination(c *gin.Context) Pagination
func (Pagination) Paginate ¶
func (p Pagination) Paginate(page, size, total uint)
func (Pagination) String ¶
func (p Pagination) String() string
type Query ¶
type Query struct { Pagination Pagination Filter filter.Filter Sort []Sort Preload []string }
func NewQueryBuilder ¶
func (*Query) ApplyToGormCount ¶
Copies the query, removing the pagination and applies it to the provided Gorm instance. Can be used to get the unpaginated total count of rows for use in pagination.
func (*Query) OrWhereGtEq ¶
func (*Query) OrWhereLike ¶
func (*Query) OrWhereLtEq ¶
func (*Query) OrWhereNotEq ¶
func (*Query) WhereNotEq ¶
Click to show internal directories.
Click to hide internal directories.