xpaging

package
v0.41.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PaginatedResponse

type PaginatedResponse[C any] struct {
	Items         []C `json:"items"`
	PagingOptions `json:",inline"`
	Total         int64 `json:"total"`
}

type PagingOptions

type PagingOptions struct {
	Offset int64 `query:"offset" json:"offset" validate:"min=0"`
	Limit  int64 `query:"limit"  json:"limit" validate:"min=0,max=100"`
}

func (PagingOptions) Normalized

func (po PagingOptions) Normalized() PagingOptions

func (PagingOptions) Validate

func (po PagingOptions) Validate() error

type SortDirection

type SortDirection int
const (
	DirectionAsc  SortDirection = 1
	DirectionDesc SortDirection = -1
)

type SortEntry

type SortEntry struct {
	FieldName string
	Direction SortDirection
}

func NewSortEntry

func NewSortEntry(fieldName string, direction SortDirection) SortEntry

func NewSortEntryFromString

func NewSortEntryFromString(fieldName string, order string) SortEntry

type SortOptions

type SortOptions []SortEntry

func NewSortOptionsFromString

func NewSortOptionsFromString(sorts string, defaultOption ...string) (SortOptions, error)

func (SortOptions) IsEmpty

func (s SortOptions) IsEmpty() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL