Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PaginatedData ¶
type PaginatedData struct { Data []bson.Raw `json:"data"` Pagination PaginationData `json:"pagination"` }
PaginatedData struct holds data and pagination detail
type PaginationData ¶
type PaginationData struct { Total int `json:"total"` Page int `json:"page"` PerPage int `json:"perPage"` Prev int `json:"prev"` Next int `json:"next"` TotalPages int `json:"totalPages"` RecordsOnPage int `json:"recordsOnPage"` }
PaginationData struct for returning pagination stat
type Paginator ¶
type Paginator struct { TotalRecord int `json:"total_record"` TotalPage int `json:"total_page"` Offset int `json:"offset"` Limit int `json:"limit"` Page int `json:"page"` PrevPage int `json:"prev_page"` NextPage int `json:"next_page"` }
Paginator struct for holding pagination info
func Paging ¶
func Paging(p *PagingQuery) *Paginator
Paging returns Paginator struct which hold pagination stats
func (*Paginator) PaginationData ¶
func (p *Paginator) PaginationData() *PaginationData
PaginationData returns PaginationData struct which holds information of all stats needed for pagination
type PagingQuery ¶
type PagingQuery struct { Collection *mongo.Collection Filter bson.M Projection *bson.D SortField *string SortValue *int Limit int Page int }
PagingQuery struct for holding mongo connection, filter needed to apply filter data with page, limit, sort key and sort value
func (*PagingQuery) Find ¶
func (paging *PagingQuery) Find() (paginatedData *PaginatedData, err error)
Find returns two value pagination data with document queried from mongodb and error if any error occurs during document query
Click to show internal directories.
Click to hide internal directories.