Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeOffsetCursor ¶
DecodeOffsetCursor takes a base64 string and decotes it to extract the offset from a string based on "cursor:offset:NUMBER". It defails to 0 if cannot decode or has any error.
func EncodeOffsetCursor ¶
EncodeOffsetCursor takes an integer and encodes to a base64 string as "cursor:offset:NUMBER"
Types ¶
type OffsetPaginator ¶
type OffsetPaginator struct { Limit int Offset int PageInfo PageInfo // contains filtered or unexported fields }
OffsetPaginator is the paginator for offset based pagination
func NewOffsetPaginator ¶
func NewOffsetPaginator( page *PageArgs, totalCount int64, defaultLimit ...*int, ) OffsetPaginator
NewOffsetPaginator creates a new offset paginator
func (*OffsetPaginator) QueryMods ¶
func (p *OffsetPaginator) QueryMods() []qm.QueryMod
QueryMods returns the sqlboilder query mods with pagination concerns
type PageArgs ¶
type PageArgs struct { First *int `json:"first,omitempty"` After *string `json:"after,omitempty"` // contains filtered or unexported fields }
PageArgs is used as the query inputs
type PageInfo ¶
type PageInfo struct { TotalCount func() (*int, error) HasPreviousPage func() (bool, error) HasNextPage func() (bool, error) StartCursor func() (*string, error) EndCursor func() (*string, error) }
PageInfo is the base struct for building PageInfo. It expects inline functions for all the fields We use inline functions so that one can build a lazy page info
func NewEmptyPageInfo ¶
func NewEmptyPageInfo() *PageInfo
NewEmptyPageInfo returns a empty instance of PageInfo. Useful for when working on a new page to be able to fullfil PageInfo requirements
type PageInfoResolver ¶
type PageInfoResolver interface { HasPreviousPage(ctx context.Context, pageInfo *PageInfo) (bool, error) HasNextPage(ctx context.Context, pageInfo *PageInfo) (bool, error) TotalCount(ctx context.Context, pageInfo *PageInfo) (*int, error) StartCursor(ctx context.Context, pageInfo *PageInfo) (*string, error) EndCursor(ctx context.Context, pageInfo *PageInfo) (*string, error) }
PageInfoResolver interface
func NewPageInfoResolver ¶
func NewPageInfoResolver() PageInfoResolver
NewPageInfoResolver returns the resolver for PageInfo