paginationhelper

package
v0.0.0-...-87346ed Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPage  int = 1
	DefaultLimit int = 10
)

Variables

This section is empty.

Functions

func CalculatePageToOffset

func CalculatePageToOffset(page, limit int) int

CalculatePageToOffset calculates offset based on page for query

page = 1 limit = 10 offset = 0

page = 2 limit = 10 offset = (2-1) * 10 = 10

page = 2 limit = 2 offset = (2- 1) * 2 = 2

page = 2 limit = 3 offset (2 - 1) * 3 = 3

func ParsePagination

func ParsePagination(page, limit string) (pageInt, limitInt int, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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