Step 12:后端轻量优化(API 稳定性 & 前端友好)

This commit is contained in:
Cheng Zhou
2025-12-16 20:03:05 +08:00
parent a54d7faf19
commit 5eab324c50
44 changed files with 161 additions and 14 deletions
+7
View File
@@ -0,0 +1,7 @@
from collections.abc import Iterable
from typing import Any
def paginate(items: Iterable[Any], total: int | None = None) -> dict[str, Any]:
items_list = list(items)
return {"items": items_list, "total": total if total is not None else len(items_list)}