mongopagination

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: MIT Imports: 5 Imported by: 0

README

mongo-go-pagination-generics

generics wrapper for github.com/gobeam/mongo-go-pagination

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PagingQuery

type PagingQuery[T any] interface {
	// Find set the filter for query results.
	Find() (records []T, paginatedData *base.PaginatedData, err error)

	Aggregate(criteria ...interface{}) (records []T, paginatedData *base.PaginatedData, err error)

	// Select used to enable fields which should be retrieved.
	Select(selector interface{}) PagingQuery[T]
	Filter(selector interface{}) PagingQuery[T]
	Limit(limit int64) PagingQuery[T]
	Page(page int64) PagingQuery[T]
	Sort(sortField string, sortValue interface{}) PagingQuery[T]
	Context(ctx context.Context) PagingQuery[T]
	SetCollation(ctx *options.Collation) PagingQuery[T]
}

PagingQuery is an interface that provides list of function you can perform on pagingQuery

func New

func New[T any](collection *mongo.Collection) PagingQuery[T]

New is to construct PagingQuery object with mongo.Database and collection name

Jump to

Keyboard shortcuts

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