pagination

package
v0.0.0-...-d841f61 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 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"`
	Filter    string `form:"filter"`
	Sort      string `form:"sort"`
	WithFlags bool   `form:"with_flags"`
}

type Query

type Query struct {
	Page     int64 `form:"page" binding:"numeric,gt=0"`
	Limit    int64 `form:"limit" binding:"numeric,gt=0"`
	Paginate bool  `form:"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