INNER CODE UNIT · Go

Paging

gobeam/mongo-go-pagination · pagination.go:51

func Paging(p *pagingQuery, paginationInfo chan<- *Paginator, aggregate bool, aggCount int64) {
	var paginator Paginator
	var offset int64
	var count int64
	ctx := p.getContext()
	if !aggregate {
		count, _ = p.Collection.CountDocuments(ctx, p.FilterQuery)
	} else {
		count = aggCount
	}

	if p.PageCount > 0 {
		offset = (p.PageCount - 1) * p.LimitCount
	} else {
		offset = 0
	}
	paginator.TotalRecord = count
	paginator.Page = p.PageCount

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…