Documentation ¶
Index ¶
Constants ¶
View Source
const ( DEFAULT_PAGINATION_LIMIT = 100 DEFAULT_MAX_PAGINATION_LIMIT = 500 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PaginatedResponse ¶
type PaginatedResponse[Obj interface{}] struct { Links PaginationLinks `json:"_links"` Count uint64 `json:"count"` Results []Obj `json:"results"` }
type PaginationArgs ¶
type PaginationArgs struct { Limit *int `json:"limit"` Offset *int `json:"offset"` // contains filtered or unexported fields }
func (*PaginationArgs) Parse ¶
func (pa *PaginationArgs) Parse(c *webcontext.Context)
type PaginationLinks ¶
type Paginator ¶
func (*Paginator[T]) Paginate ¶
func (pr *Paginator[T]) Paginate(c *webcontext.Context, getPage func(limit, offset int) (Iterator[T], error)) (*PaginatedResponse[T], error)
Paginate mounts a PaginatedResponse. It expects a getPage function that receives limit and offset integers and returns an iterator, the total of rows and an error
Click to show internal directories.
Click to hide internal directories.