pagination

package
v0.0.0-...-a52d1cd Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 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

This section is empty.

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 (*PaginatedResponse) Render

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

type PaginationService

type PaginationService struct {
	Request *http.Request
}

func (PaginationService) ApplyQueryOffsetAndLimit

func (service PaginationService) ApplyQueryOffsetAndLimit(query QueryOffsetAndLimit)

func (PaginationService) GetRequestOffsetAndLimit

func (service PaginationService) GetRequestOffsetAndLimit() (int, int)

func (PaginationService) PreparePaginatedResponse

func (service PaginationService) PreparePaginatedResponse(items []render.Renderer, totalCount int) PaginatedResponse

type PaginationServiceInterface

type PaginationServiceInterface interface {
	GetRequestOffsetAndLimit() (int, int)
	ApplyQueryOffsetAndLimit(query QueryOffsetAndLimit)
	PreparePaginatedResponse(items []render.Renderer, totalCount int) PaginatedResponse
}

type QueryOffsetAndLimit

type QueryOffsetAndLimit interface {
	Offset(offset int) *gorm.DB
	Limit(limit int) *gorm.DB
}

Jump to

Keyboard shortcuts

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