pagination

package
v0.0.0-...-bb1c6aa Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const PAGINATION_DEFAULT_LIMIT = 100
View Source
const PAGINATION_MAX_LIMIT = 1000

Variables

This section is empty.

Functions

func ApplyQueryOffsetAndLimit

func ApplyQueryOffsetAndLimit(query *gorm.DB, offset int, limit int) *gorm.DB

func GetRequestOffsetAndLimit

func GetRequestOffsetAndLimit(request *http.Request) (int, int)

Types

type PaginatedResponse

type PaginatedResponse struct {
	Items              []render.Renderer `json:"items"`
	TotalCount         int               `json:"total_count"`
	PageCount          int               `json:"page_count"`
	NextPageOffset     int               `json:"next_page_offset"`
	PreviousPageOffset int               `json:"previous_page_offset"`
}

func PreparePaginatedResponse

func PreparePaginatedResponse(items []render.Renderer, offset int, limit int, totalCount int) PaginatedResponse

func (*PaginatedResponse) Render

func (logEntry *PaginatedResponse) Render(writer http.ResponseWriter, request *http.Request) error

Jump to

Keyboard shortcuts

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