paging

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

@index 공통 pagination 타입과 limit/offset 정규화 규칙을 제공한다.

Index

Constants

View Source
const (
	DefaultLimit = 50
	MaxLimit     = 500
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {
	Limit      int  `json:"limit"`
	Offset     int  `json:"offset"`
	Returned   int  `json:"returned"`
	HasMore    bool `json:"has_more"`
	NextOffset *int `json:"next_offset,omitempty"`
}

Page describes one bounded result window. @intent expose stable pagination metadata to MCP clients and prompts.

func BuildPage

func BuildPage(req Request, returned int, hasMore bool) Page

BuildPage creates pagination metadata for one returned page. @intent generate one consistent pagination envelope after services compute has_more.

type Request

type Request struct {
	Limit  int
	Offset int
}

Request describes a limit/offset pagination request. @intent carry bounded pagination inputs between handlers and services.

func Normalize

func Normalize(req Request) (Request, error)

Normalize applies defaulting and validates a pagination request. @intent centralize bounded pagination validation so handlers and services share one rule set.

func NormalizeWithDefault

func NormalizeWithDefault(req Request, defaultLimit int) (Request, error)

NormalizeWithDefault applies validation using a caller-provided default limit. @intent support tool-specific defaults while preserving the shared max-limit and offset rules.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL