Documentation
¶
Index ¶
- func Count(resultCount, limit int) int
- func FilterExtractValues(values *fasthttp.Args, column string) (result []string, param string, query *fasthttp.Args)
- func FilterSetValues(values *fasthttp.Args, param, column string, valuesToAdd ...string)
- func Offset(page, limit int) int
- func Query(args *fasthttp.Args, allowedColumns map[string]bool) func(*gorm.DB) *gorm.DB
- func Sort(args *fasthttp.Args, allowedColumns map[string]bool) func(*gorm.DB) *gorm.DB
- type Model
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Count ¶
Count calculates the page count with the given resultCount of a pagination query and a page limit.
func FilterExtractValues ¶ added in v1.0.0
func FilterExtractValues(values *fasthttp.Args, column string) (result []string, param string, query *fasthttp.Args)
FilterExtractValues extracts the values for a specific column from the pagination filter arguments.
values: needs to be a querystring in the format "?column_name:value1,value2,...;other_column:other_value&"
func FilterSetValues ¶ added in v1.0.0
FilterSetValues adds or updates values for a specific column in the pagination filter arguments.
Types ¶
type Model ¶
type Model struct {
Limit int `json:"limit"`
Page int `json:"page"`
PageCount int `json:"pageCount"`
Total int `json:"total"`
Result interface{} `json:"result"`
}
Model struct is used to return paginated data.
func CreatePaginationModel ¶
CreatePaginationModel is a helper to be able to return a pagination model in a single line
Click to show internal directories.
Click to hide internal directories.