Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

pager source pure

Functions 1

func NewPager

1func NewPager(tree rotree.IReadOnlyTree, defaultPageSize int, reversed bool) *Pager
source

NewPager creates a new Pager with default values.

Types 3

type Item

struct
1type Item struct {
2	Key   string
3	Value any
4}
source

Item represents a key-value pair in the AVL tree.

type Page

struct
 1type Page struct {
 2	Items      []Item
 3	PageNumber int
 4	PageSize   int
 5	TotalItems int
 6	TotalPages int
 7	HasPrev    bool
 8	HasNext    bool
 9	Pager      *Pager // Reference to the parent Pager
10}
source

Page represents a single page of results.

Methods on Page

func Picker

method on Page
1func (p *Page) Picker(path string) string
source

Picker generates the Markdown UI for the page Picker

type Pager

struct
1type Pager struct {
2	Tree            rotree.IReadOnlyTree
3	PageQueryParam  string
4	SizeQueryParam  string
5	DefaultPageSize int
6	Reversed        bool
7}
source

Pager is a struct that holds the AVL tree and pagination parameters.

Methods on Pager

func GetPage

method on Pager
1func (p *Pager) GetPage(pageNumber int) *Page
source

GetPage retrieves a page of results from the AVL tree.

func GetPageByPath

method on Pager
1func (p *Pager) GetPageByPath(rawURL string) (*Page, error)
source

GetPageByPath retrieves a page of results based on the query parameters in the URL path.

func GetPageWithSize

method on Pager
1func (p *Pager) GetPageWithSize(pageNumber, pageSize int) *Page
source

func ParseQuery

method on Pager
1func (p *Pager) ParseQuery(rawURL string) (int, int, error)
source

ParseQuery parses the URL to extract the page number and page size.

Imports 5

Source Files 4