pagination

package
v0.0.0-...-5167e8f Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPage     = 1
	DefaultLimit    = 10
	DefaultPaginate = true
)

Variables

This section is empty.

Functions

func BindFilteredQuery

func BindFilteredQuery(c *gin.Context, query *FilteredQuery) error

func BindQuery

func BindQuery(c *gin.Context, query *Query) error

func CreateAggregationPipeline

func CreateAggregationPipeline(
	query Query,
	filter []bson.M,
	sort bson.M,
	project ...[]bson.M,
) []bson.M

Types

type FilteredQuery

type FilteredQuery struct {
	Query
	Search    string `form:"search"`
	Sort      string `form:"sort"`
	WithFlags bool   `form:"with_flags"`
}

type Query

type Query struct {
	Page     int64 `form:"page" json:"page" binding:"numeric,gt=0"`
	Limit    int64 `form:"limit" json:"limit" binding:"numeric,gt=0"`
	Paginate bool  `form:"paginate" json:"paginate"`
}

Query is base request for pagination.

func GetDefaultQuery

func GetDefaultQuery() Query

Jump to

Keyboard shortcuts

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