Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithMaxPageSize ¶ added in v0.13.0
func WithMaxPageSize[INT constraints.Unsigned](maxPageSize INT) func(*Page[INT])
WithMaxPageSize configures the maximum allowed page size for pagination parameters validation.
Types ¶
type OrderBy ¶
type OrderBy []OrderByPair
OrderBy collects multiple sorting criteria for query
func OneOrderBy ¶
func OneOrderBy(name string, direction OrderByDirection) OrderBy
OneOrderBy creates OrderBy with single sorting pair
func TwoOrderBy ¶
func TwoOrderBy(name0 string, direction0 OrderByDirection, name1 string, direction1 OrderByDirection) OrderBy
TwoOrderBy creates OrderBy with two sorting pairs
type OrderByDirection ¶
type OrderByDirection string
OrderByDirection defines sorting direction for SQL ORDER BY clause
var ( // ASC ascending sort order ASC OrderByDirection = "ASC" // DESC descending sort order DESC OrderByDirection = "DESC" )
type OrderByPair ¶
type OrderByPair struct {
Name string
Direction OrderByDirection
}
OrderByPair represents a field and its sorting direction pair
func (OrderByPair) String ¶
func (pair OrderByPair) String() string
type Page ¶
type Page[INT constraints.Unsigned] struct { // contains filtered or unexported fields }
Page defines pagination parameters for query operations
func NewPage ¶
func NewPage[INT constraints.Unsigned](pageNo, pageSize INT, opts ...func(*Page[INT])) (pg *Page[INT])
NewPage creates pagination parameters with validation
func (*Page[INT]) PageSize ¶
func (pg *Page[INT]) PageSize() INT
PageSize returns configured items per page
func (*Page[INT]) TotalPages ¶
func (pg *Page[INT]) TotalPages(totalRecords INT) (totalPages INT)
TotalPages calculates total pages based on total records count
Click to show internal directories.
Click to hide internal directories.