{% extends "main.html" %} {% block tabs %} {{ super() }} {#- Language detection -#} {% set is_zh = (i18n_file_locale | default('en')) == 'zh' %} {#- Translation macro -#} {% macro t(en, zh) %}{% if is_zh %}{{ zh }}{% else %}{{ en }}{% endif %}{% endmacro %}
{{ t("Open Source", "开源项目") }} · Pydantic v2 · Python 3.10+

{{ t("Declarative Data Assembly", "声明式数据组装") }}

{{ t( "A BFF toolkit for Python. Compose complex nested APIs declaratively — zero N+1, zero boilerplate.", "Python 的 BFF 工具。声明式组装复杂嵌套 API,零 N+1 查询,零样板代码。" )}}

pip install pydantic-resolve

{{ t("Solve N+1 in a few lines of code", "几行代码解决 N+1 问题") }}

{{ t("Replace manual loops with declarative data loading.", "用声明式数据加载替代手动循环查询。") }}

{{ t("Before — N+1 problem", "Before — N+1 问题") }}
# Sprint has 10 tasks, each needs owner
for task in sprint.tasks:
    task.owner = await get_user(task.owner_id)
 # 10 queries!
{{ t("After — pydantic-resolve", "After — pydantic-resolve") }}
class TaskView(BaseModel):
    owner_id: int
    owner: Optional[UserView] = None

    def resolve_owner(self, loader=Loader(user_loader)):
        return loader.load(self.owner_id)
 # 1 query!

{{ t("Everything you need for data assembly", "数据组装的全套工具") }}

{{ t("From loading related data to generating GraphQL APIs — all in one library.", "从加载关联数据到生成 GraphQL API — 一个库全覆盖。") }}

{{ t("Batch Loading", "批量加载") }}

{{ t("Auto-batch queries via DataLoader pattern. 100 lookups become 1 query.", "通过 DataLoader 模式自动批量查询,100 次查询变 1 次。") }}

{{ t("Post Processing", "后处理") }}

{{ t("Compute derived fields after all nested data is resolved. Counts, aggregates, formatting.", "在嵌套数据就绪后计算派生字段:计数、聚合、格式化。") }}

{{ t("Cross-Layer Data Flow", "跨层数据流") }}

{{ t("ExposeAs, SendTo, Collector — pass context down or aggregate data up without traversal code.", "ExposeAs / SendTo / Collector,无需手写遍历逻辑即可跨层传递数据。") }}

{{ t("ER Diagram + AutoLoad", "ER 图 + AutoLoad") }}

{{ t("Centralize relationship declarations. Reuse across models, GraphQL, and MCP services.", "集中管理关系声明,跨模型复用,同时驱动 GraphQL 和 MCP。") }}

{{ t("GraphQL Generation", "GraphQL 生成") }}

{{ t("Auto-generate GraphQL schema and resolvers from your ER Diagram.", "从 ER 图自动生成 GraphQL schema 和 resolver。") }}

{{ t("MCP Service", "MCP 服务") }}

{{ t("Expose GraphQL APIs to AI agents via Model Context Protocol.", "通过 MCP 协议将 GraphQL API 暴露给 AI 代理。") }}

{{ t("Progressive learning path", "循序渐进的学习路径") }}

{{ t("Start simple, scale as needed. Each concept builds on the last.", "从简单开始,按需扩展。每个概念都建立在前一个之上。") }}

1 {{ t("resolve_*", "resolve_*") }}
2 {{ t("Nested Tree", "嵌套树") }}
3 {{ t("post_*", "post_*") }}
4 {{ t("Cross-Layer", "跨层数据流") }}
5 {{ t("ERD + AutoLoad", "ERD + AutoLoad") }}
6 {{ t("GraphQL / MCP", "GraphQL / MCP") }}

{{ t("Aligns with Clean Architecture", "贴合整洁架构") }}

{{ t("ER Diagram doubles as entity and use-case layer, cleanly isolating your database.", "ER 图同时充当实体层和用例层,干净地隔离数据库实现。") }}

{{ t("Entity + Use Case", "实体层 + 用例层") }}

{{ t("ER Diagram defines entities and their relationships — it naturally serves as both the domain model and the use-case boundary.", "ER Diagram 定义实体及其关系,天然充当领域模型和用例边界。") }}

{{ t("DB Agnostic", "数据库无关") }}

{{ t("Loaders abstract away the data source. Swap SQLAlchemy for Django or Tortoise ORM — your models stay untouched.", "Loader 抽象了数据源。从 SQLAlchemy 切换到 Django 或 Tortoise ORM,模型层无需改动。") }}

{{ t("Multi-Presentation", "多呈现层") }}

{{ t("One ERD drives REST API responses, GraphQL queries, and MCP services — without duplication.", "一份 ERD 同时驱动 REST API 响应、GraphQL 查询和 MCP 服务,零重复。") }}

{{ t("Built for your stack", "为你的技术栈而建") }}

{{ t("Works with your existing frameworks and ORMs.", "与你现有的框架和 ORM 无缝集成。") }}

{{ t("Ready to eliminate N+1 queries?", "准备好消灭 N+1 查询了吗?") }}

{{ t("Start with a single resolve method. Scale to ER Diagram when you're ready.", "从一个 resolve 方法开始,准备好了再扩展到 ER 图。") }}

{% endblock %} {% block content %}{% endblock %} {% block footer %}{% endblock %}