Documentation ¶
Index ¶
- func OrderByScope(model any, sort string) func(db *gorm.DB) *gorm.DB
- func Paginate[T any](db *gorm.DB, p Pagination, out *[]T, query ...func(db *gorm.DB) *gorm.DB) (int64, error)
- type DefaultPagination
- func (p *DefaultPagination) GetFilter() map[string]string
- func (p *DefaultPagination) GetPage() int
- func (p *DefaultPagination) GetSearch() string
- func (p *DefaultPagination) GetSize() int
- func (p *DefaultPagination) GetSort() string
- func (p *DefaultPagination) SetDefaultSort(sort string) Pagination
- type Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OrderByScope ¶ added in v0.2.0
Types ¶
type DefaultPagination ¶ added in v0.4.0
type DefaultPagination struct { Page int `query:"page" minimum:"1" default:"1"` Size int `query:"size" minimum:"1" default:"10"` Sort string `query:"sort" description:"1. asc: **id**\n2. desc: **-id**\n3. multi: **id,created_at**"` Search string `query:"search"` Filter map[string]string `` /* 169-byte string literal not displayed */ }
func (*DefaultPagination) GetFilter ¶ added in v0.4.0
func (p *DefaultPagination) GetFilter() map[string]string
func (*DefaultPagination) GetPage ¶ added in v0.4.0
func (p *DefaultPagination) GetPage() int
func (*DefaultPagination) GetSearch ¶ added in v0.4.0
func (p *DefaultPagination) GetSearch() string
func (*DefaultPagination) GetSize ¶ added in v0.4.0
func (p *DefaultPagination) GetSize() int
func (*DefaultPagination) GetSort ¶ added in v0.4.0
func (p *DefaultPagination) GetSort() string
func (*DefaultPagination) SetDefaultSort ¶ added in v0.4.0
func (p *DefaultPagination) SetDefaultSort(sort string) Pagination
Click to show internal directories.
Click to hide internal directories.