Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidCursor = fmt.Errorf("invalid cursor")
)
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"` HasNext bool `json:"has_next"` HasPrev bool `json:"has_prev"` }
func Paginate ¶
func Paginate[T CursorProvider](params Params, paginateFunc PagingFunc[T]) (Result[T], error)
Click to show internal directories.
Click to hide internal directories.