Documentation ¶
Overview ¶
package pagination provides common interfaces for paginating queries and query results.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PagesForCount ¶
PagesForCount returns the number of pages that total_count will span using criteria defined in opts.
Types ¶
type Method ¶ added in v0.1.1
type Method uint8
Method defines the type of pagination Options or Results.
type Options ¶ added in v0.1.1
type Options interface { // Get or set the number of results to return in a Results PerPage(...int64) int64 // Get or set current page to return query results for Spill(...int64) int64 // Get or set the name of the column to use when paginating results Column(...string) string // Get or set the pointer (page number or cursor) for the next set of query results Pointer(...interface{}) interface{} // Return the Method type associated with Options Method() Method }
Options provides a common interface for criteria used to paginate a query.
type Results ¶ added in v0.1.1
type Results interface { // The total number of results for a query. Total() int64 // The number of results per page for a query. PerPage() int64 // The current page number (offset) for a paginated query response. Page() int64 // The total number of pages for a paginated query response. Pages() int64 // The value to use to advance to the next set of results in a query response. Next() interface{} // The value to use to rewind to the previous set of results in a query response. Previous() interface{} // The URL to the next set of results in a query response NextURL(t *uritemplates.UriTemplate) (string, error) // The URL to the previous set of results in a query response PreviousURL(*uritemplates.UriTemplate) (string, error) // Return the Method type associated with Results Method() Method }
Results provides an interface for pagination information for a query response.
Directories ¶
Path | Synopsis |
---|---|
package countable provides implementions of the pagintion.Options and pagination.Results interfaces for use with page-based or numbered pagination.
|
package countable provides implementions of the pagintion.Options and pagination.Results interfaces for use with page-based or numbered pagination. |
package cursor provides implementions of the pagintion.Options and pagination.Results interfaces for use with cursor or token-based pagination.
|
package cursor provides implementions of the pagintion.Options and pagination.Results interfaces for use with cursor or token-based pagination. |
Click to show internal directories.
Click to hide internal directories.