MCPcopy Create free account
hub / github.com/astercloud/aster / Paginated

Function Paginated

pkg/server/response.go:69–78  ·  view source on GitHub ↗

Paginated 辅助函数:发送分页响应

(w http.ResponseWriter, items any, total, page, pageSize int)

Source from the content-addressed store, hash-verified

67
68// Paginated 辅助函数:发送分页响应
69func Paginated(w http.ResponseWriter, items any, total, page, pageSize int) {
70 totalPages := (total + pageSize - 1) / pageSize
71 JSON(w, http.StatusOK, &PaginatedResponse{
72 Items: items,
73 Total: total,
74 Page: page,
75 PageSize: pageSize,
76 TotalPages: totalPages,
77 })
78}
79
80// Created 辅助函数:发送 201 Created 响应
81func Created(w http.ResponseWriter, data any) {

Callers

nothing calls this directly

Calls 1

JSONFunction · 0.85

Tested by

no test coverage detected