summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-04-21 14:21:20 +0700
committerShulhan <ms@kilabit.info>2021-04-21 14:21:20 +0700
commitb041fd962bbb3fcd79b162b42da3ec48e0eaba26 (patch)
tree8c440b5d7f5c8e233e15a16aad920cbed616542e
parentabc1e75a9f65c53c60d34dca7232064d8f4360c4 (diff)
downloadpakakeh.go-b041fd962bbb3fcd79b162b42da3ec48e0eaba26.tar.xz
http: add field Page to EndpointResponse
The page field contains the requested page or current response. If page is from request then the offset will be set to page times limit. While at it, move the field comment to its declaration.
-rw-r--r--lib/http/endpoint_response.go28
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/http/endpoint_response.go b/lib/http/endpoint_response.go
index d6808254..921464b9 100644
--- a/lib/http/endpoint_response.go
+++ b/lib/http/endpoint_response.go
@@ -8,21 +8,29 @@ import liberrors "github.com/shuLhan/share/lib/errors"
// Its embed the lib/errors.E type to work seamlessly with Endpoint.Call
// handler for checking the returned error.
//
-// If the response is paging, contains more than one item in data, one
-// can set the current status of paging in field Offset, Limit, and Count.
-//
-// The Offset field contains the start index of paging.
-// The Limit field contains the maximum number of records per page.
-// The Count field contains the total number of records.
+// If the response is paging, contains more than one item in Data, one
+// can set the current status of paging in field Limit, Offset, Page, and
+// Count.
//
// See the example below on how to use it with Endpoint.Call handler.
//
type EndpointResponse struct {
liberrors.E
- Data interface{} `json:"data,omitempty"`
- Offset int64 `json:"offset,omitempty"`
- Limit int64 `json:"limit,omitempty"`
- Count int64 `json:"count,omitempty"`
+ Data interface{} `json:"data,omitempty"`
+
+ // The Limit field contains the maximum number of records per page.
+ Limit int64 `json:"limit,omitempty"`
+
+ // The Offset field contains the start index of paging.
+ // If Page values is from request then the offset will be set to page
+ // times limit.
+ Offset int64 `json:"offset,omitempty"`
+
+ // The Page field contains the requested or current page of response.
+ Page int64 `json:"page,omitempty"`
+
+ // Count field contains the total number of records.
+ Count int64 `json:"count,omitempty"`
}
//