GraphQL Relay Specification #Facebook Relay文档翻译#
来源:互联网 发布:nba2k17詹姆斯身体数据 编辑:程序博客网 时间:2024/05/18 01:02
原文地址
上一篇 Babel Relay Plugin
Relay文档翻译目录
The three core assumptions that Relay makes about a GraphQL server are that it
provides:
Relay使用的GraphQL server得满足以下三点核心假设:
- A mechanism for refetching an object.
重新获取对象的机制 - A description of how to page through connections.
如何在connection上进行分页描述 - Structure around mutations to make them predictable.
对mutation进行结构化,让他们变得可预测
This example demonstrates all three of these assumptions.
下面的例子说明了这三点假设。
This example is not comprehensive, but it is designed to quickly introduce
these core assumptions, to provide some context before diving into
the more detailed specification or the library.
这个例子并不深刻,只是给你可以快速的预览,有助于你日后深入了解。
The premise of the example is that we want to use GraphQL to query for
information about ships and factions in the original Star Wars
trilogy.
例子的前提是我们希望用GraphQL来查询在星球大战三部曲中ships和factions的信息。
It is assumed that the reader is already familiar with GraphQL; if not,
the README for GraphQL.js is a
good place to start.
这里假设您已经熟悉GraphQL,如果不请阅读README GraphQL.js
It is also assumed that the reader is already familiar with Star Wars; if not,
the 1977 version of Star Wars is a good place to start, though the 1997
Special Edition will serve for the purposes of this document.
当然还希望您是了解星球大战的,如果不,1977、1997的版本您可以看看。
Schema
The schema described below will be used to demonstrate the functionality
that a GraphQL server used by Relay should implement. The two core types
are a faction and a ship in the Star Wars universe, where a faction
has many ships associated with it. The schema below is the output of the
GraphQL.js schemaPrinter
.
下面的schema被用于说明Relay使用的GraphQL server应该实现哪些功能。在星球大战中有两个核心类型faction和ship,一个faction可以有很多ship。以下schema是用过GraphQL.js schemaPrinter
打印输出的。
interface Node { id: ID!}type Faction : Node { id: ID! name: String ships: ShipConnection}type Ship : Node { id: ID! name: String}type ShipConnection { edges: [ShipEdge] pageInfo: PageInfo!}type ShipEdge { cursor: String! node: Ship}type PageInfo { hasNextPage: Boolean! hasPreviousPage: Boolean! startCursor: String endCursor: String}type Query { rebels: Faction empire: Faction node(id: ID!): Node}input IntroduceShipInput { factionId: String! shipNamed: String! clientMutationId: String!}type IntroduceShipPayload { faction: Faction ship: Ship clientMutationId: String!}type Mutation { introduceShip(input: IntroduceShipInput!): IntroduceShipPayload}
- GraphQL Relay Specification #Facebook Relay文档翻译#
- Thinking in GraphQL #Facebook Relay文档翻译#
- Babel Relay Plugin #Facebook Relay文档翻译#
- Thinking In Relay #Facebook Relay文档翻译#
- Tutorial #Facebook Relay文档翻译#
- Containers #Facebook Relay文档翻译#
- Routes #Facebook Relay文档翻译#
- Mutations #Facebook Relay文档翻译#
- Connection #Facebook Relay文档翻译#
- Mutations #Facebook Relay文档翻译#
- Relay文档翻译目录 #Facebook Relay文档翻译#
- Getting Start #Facebook Relay文档翻译#
- Root Container #Facebook Relay文档翻译#
- Ready State #Facebook Relay文档翻译#
- Network Layer #Facebook Relay文档翻译#
- Object Identification #Facebook Relay文档翻译#
- Facebook的Web开发三板斧:React.js、Relay和GraphQL
- Facebook的Web开发三板斧:React.js、Relay和GraphQL
- ICMP Internet 控制报文协议
- iOS开发之NSBundle的使用详解
- 为什么Android手机用一年之后都会出现卡成狗
- Ubuntu 安装mysql和简单操作
- Java String之String和CharSequence、StringBuilder和StringBuffer的区别
- GraphQL Relay Specification #Facebook Relay文档翻译#
- NOI库7614 最低通行费
- 单链表
- 黑马程序员—浅谈运算符重难点及注意事项
- SSH——Struts2中引入Spring
- 数组与字符串的相互转化
- ListView中BaseAdapter优化三重境界
- 第十一篇:关于main中的两个参数的使用请况
- Ubuntu下设置mysql数据库字符集为utf8的方法