Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeCursor ¶
Types ¶
type CursorProvider ¶
type CursorProvider interface {
GetCursorValue() string
}
type PagingFunc ¶
type Params ¶
type Params struct {
Cursor string `json:"cursor"`
Limit int `json:"limit"`
Direction string `json:"direction"` // "forward" or "backward"
}
func NormalizeParams ¶
type Result ¶
type Result[T CursorProvider] struct { Items []T `json:"items"` Total int `json:"total"` Cursor string `json:"cursor,omitempty"` NextCursor string `json:"next_cursor,omitempty"` PrevCursor string `json:"prev_cursor,omitempty"` HasNextPage bool `json:"has_next_page"` HasPrevPage bool `json:"has_prev_page"` }
func Paginate ¶
func Paginate[T CursorProvider](params Params, paginateFunc PagingFunc[T]) (Result[T], error)
Click to show internal directories.
Click to hide internal directories.