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 Pagination
- type PaginationDefault
- func (p *PaginationDefault) GetFilter() map[string]string
- func (p *PaginationDefault) GetPage() int
- func (p *PaginationDefault) GetSearch() string
- func (p *PaginationDefault) GetSize() int
- func (p *PaginationDefault) GetSort() string
- func (p *PaginationDefault) SetDefaultSort(sort string) Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OrderByScope ¶ added in v0.2.0
Types ¶
type Pagination ¶
type PaginationDefault ¶ added in v0.3.0
type PaginationDefault 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 (*PaginationDefault) GetFilter ¶ added in v0.3.0
func (p *PaginationDefault) GetFilter() map[string]string
func (*PaginationDefault) GetPage ¶ added in v0.3.0
func (p *PaginationDefault) GetPage() int
func (*PaginationDefault) GetSearch ¶ added in v0.3.0
func (p *PaginationDefault) GetSearch() string
func (*PaginationDefault) GetSize ¶ added in v0.3.0
func (p *PaginationDefault) GetSize() int
func (*PaginationDefault) GetSort ¶ added in v0.3.0
func (p *PaginationDefault) GetSort() string
func (*PaginationDefault) SetDefaultSort ¶ added in v0.3.0
func (p *PaginationDefault) SetDefaultSort(sort string) Pagination
Click to show internal directories.
Click to hide internal directories.