yanmoai6666-star/go-simple-api

为列表接口添加分页功能

Open

#2 opened on Dec 5, 2025

 (0 comments) (0 reactions) (0 assignees)Go (0 forks)auto 404
enhancementhelp wanted

Repository metrics

Stars
 (0 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

目前 GET /api/v1/productsGET /api/v1/users 接口会返回所有数据,当数据量增大时可能导致响应缓慢、资源消耗过高。
建议实现分页功能,通过 URL 查询参数(如 ?page=1&pageSize=20)控制返回数据量,在 service 层的 GetAllProductsGetAllUsers 方法中添加分页逻辑,同时在响应中返回总条数、总页数等元信息,提升接口性能。

Contributor guide