Documentation
¶
Overview ¶
Package pagination provides a simple pagination helpers that can be used for API pagination purposes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeToken ¶
DecodeToken decodes a gob encoded string into an input struct.
func TokenizeStruct ¶
TokenizeStruct encodes input value as a gob.Encoded string. The input should be a non exported golang struct, that contains exported fields, that could be decoded with a valid Next filter expression. The output string is a url safe base64 encoded gob of this struct.
Types ¶
type NextTokenExpr ¶
type NextTokenExpr struct {
// Filter is a filter expression, that should be used to filter the next page.
Filter expr.FilterExpr
// OrderBy is an optional ordering expression, that should be used to order the next page.
OrderBy *expr.OrderByExpr
}
NextTokenExpr is a pagination token filter expression. This can be used directly as a token struct, or embeddable in some internal packages for open-source implementations.
func (*NextTokenExpr) Free ¶
func (n *NextTokenExpr) Free()
Free returns the allocated memory for both Filter and OrderBy fields.