Documentation ¶
Overview ¶
Package tome was designed to paginate simple RESTful APIs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chapter ¶
type Chapter struct { // The base URL for the endpoint. // It is only necessary when using links. // Will be omitted from JSON when links are set to false. BaseURL string `json:"base_url,omitempty"` // The next URL string. // Will be omitted from JSON when links are set to false. NextURL string `json:"next_url,omitempty"` // The previous URL string. // Will be omitted from JSON when links are set to false. PreviousURL string `json:"prev_url,omitempty"` // Whether to create links or not. // Pagination without links is faster. Links bool `json:"-"` // The inicial offset position. Offset int `json:"-"` // The limit per page. // If none is provided, the limit will be setted to 10. Limit int `json:"per_page"` // The new page number captured on the request params. // Will be omitted from JSON, since there is no need for it. NewPage int `json:"-"` // The current page of the tome. // If none is provided, the current page will be setted to 1. CurrentPage int `json:"current_page"` // The last page of the tome. LastPage int `json:"last_page"` // The total results, this usually comes from // a database query. TotalResults int `json:"total_results"` }
Chapter handles pagination results.
Click to show internal directories.
Click to hide internal directories.