paginate

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type M

type M struct {
	// Limit set the number of data that should be retrieved from DB. This may
	// be filled from query param in request.
	Limit int `json:"per_page,omitempty" query:"limit" example:"1"`
	// Page based on given Limit which page of data we want to retrieve.
	Page int `json:"current_page,omitempty" query:"page" example:"1"`
	// Next the next page number from current page.
	Next int `json:"next_page,omitempty"`
	// Prev the previous page number from current page.
	Prev int `json:"previous_page,omitempty"`
	// TotalPage based on given Limit how many page that can be divided from
	// total available data.
	TotalPage int `json:"total_page,omitempty"`
	// contains filtered or unexported fields
}

M standard pagination object that should be embedded to request/response object that need pagination feature.

func (*M) Paginate

func (m *M) Paginate()

Paginate setup current, previous and next page based on the count & Limit fields. This should be called after retrieving the actual data from DB.

func (*M) Set

func (m *M) Set(db *gorm.DB) *gorm.DB

Set implementation of repository.IOptions.

Jump to

Keyboard shortcuts

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