知识卡片
GraphQL按需查询字段
GraphQL 是面向 API 的查询语言,客户端可声明所需字段,并在一次请求中沿对象关系取得多个资源的部分数据。它适合客户端只需大对象少数字段或需组合关联数据的场景;是否减少传输量,还取决于查询设计与服务端实际返回内容。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 3 部分《Designing and building GraphQL APIs》(源文件:_epub-src/OEBPS/Text/p3.htm)
- 结论依据:原文定义 GraphQL 为 API 查询语言,对比取回整份资源与只取一个或多个属性,并说明可在一次请求中跨对象关系获取字段。
- 原始内容:GraphQL is a query language for APIs. Instead of fetching full representations of resources, GraphQL allows you to fetch one or more properties of a resource, such as the price of a product or the status of an order. With GraphQL, we can also model the relationship between different objects