mirror of
https://github.com/arnaucube/hermez-node.git
synced 2026-02-07 11:26:44 +01:00
Impls exit endpoints and change pagination to cursor
This commit is contained in:
15
db/utils.go
15
db/utils.go
@@ -177,3 +177,18 @@ func SlicePtrsToSlice(slice interface{}) interface{} {
|
||||
}
|
||||
return res.Interface()
|
||||
}
|
||||
|
||||
// Pagination give information on the items of a query
|
||||
type Pagination struct {
|
||||
TotalItems int `json:"totalItems"`
|
||||
FirstItem int `json:"firstItem"`
|
||||
LastItem int `json:"lastItem"`
|
||||
FirstReturnedItem int `json:"-"`
|
||||
LastReturnedItem int `json:"-"`
|
||||
}
|
||||
|
||||
// Paginationer is an interface that allows getting pagination info on any struct
|
||||
type Paginationer interface {
|
||||
GetPagination() *Pagination
|
||||
Len() int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user