Skip to content

Commit 3249e5d

Browse files
ydfzgyjjonirrings
authored andcommitted
up to date 20181124 (xitu#98)
1 parent 83edf29 commit 3249e5d

File tree

9 files changed

+47
-8
lines changed

9 files changed

+47
-8
lines changed

site/blog/20160502-rest-api-graphql-wrapper.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const PersonType = new GraphQLObjectType({
141141
/* ... */
142142
friends: {
143143
type: new GraphQLList(PersonType),
144-
resolve: person => person.friends.map(getPersonByURL),
144+
resolve: person => person.friends.map(fetchPersonByURL),
145145
},
146146
}),
147147
});
@@ -395,7 +395,7 @@ To create a `DataLoader` you supply a method that can resolve a list of objects
395395

396396
```js
397397
const personLoader = new DataLoader(
398-
urls => Promise.all(urls.map(getPersonByURL))
398+
urls => Promise.all(urls.map(fetchPersonByURL))
399399
);
400400
```
401401

site/code/index.html.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ $ curl -XPOST "http://0:3000" -H'Content-Type: application/json' -d'{
107107
(executor/execute nil schema resolver-fn "{ hello }")
108108
\`\`\`
109109
110-
- [lacinia](https://github.com/walmartlabs/lacinia):一套 GraphQL 规范的完整实现,致力于维护对规范的外部兼容。
110+
#### [lacinia](https://github.com/walmartlabs/lacinia)
111+
112+
一套 GraphQL 规范的完整实现,致力于维护对规范的外部兼容。
111113
112114
### Elixir
113115
@@ -335,7 +337,7 @@ $resolvers = [
335337
];
336338
$schema = Graphql\schema($typeDefs, $resolvers);
337339
338-
echo "Server running at http://127.0.0.1:8080\\n";
340+
echo "Server running at http://127.0.0.1:8080";
339341
Http\server(Graphql\psr7($schema), function (\Throwable $err) {
340342
var_dump($err);
341343
return Diactoros\json([

site/community/Community-Events.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,4 @@ GraphQL Conf 是欧洲非营利性的 GraphQL 大会,邀请了来自世界各
7272
- [GraphQL Tel Aviv](https://www.meetup.com/GraphQL-TLV/)
7373
- [GraphQL Tokyo](https://www.meetup.com/GraphQL-Tokyo/)
7474
- [GraphQL Meetup (Bangalore)](https://www.meetup.com/GraphQL-Meetup/)
75+
- [GraphQL Meetup (Bangkok)](https://www.meetup.com/GraphQL-Bangkok/)

site/community/Community-Resources.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ sublinks: 博客,视频
2323

2424
- [@GraphQL](https://twitter.com/GraphQL)
2525
- [@graphqlweekly](https://twitter.com/graphqlweekly)
26-
- [@graphqlnews](https://twitter.com/graphqlnews)
2726
- [@GraphQLStackOverflow](https://twitter.com/GraphQLatSO)
2827
- [@apollographql](https://twitter.com/apollographql)
2928
- [@graphcool](https://twitter.com/graphcool)

site/learn/Learn-Queries.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,33 @@ fragment comparisonFields on Character {
124124

125125
你可以看到上面的查询如何漂亮地重复了字段。片段的概念经常用于将复杂的应用数据需求分割成小块,特别是你要将大量不同片段的 UI 组件组合成一个初始数据获取的时候。
126126

127+
### 在片段内使用变量
128+
129+
片段可以访问查询或变更中声明的变量。详见 [变量](learn/queries/#variables)
130+
131+
```graphql
132+
# { "graphiql": true }
133+
query HeroComparison($first: Int = 3) {
134+
leftComparison: hero(episode: EMPIRE) {
135+
...comparisonFields
136+
}
137+
rightComparison: hero(episode: JEDI) {
138+
...comparisonFields
139+
}
140+
}
141+
142+
fragment comparisonFields on Character {
143+
name
144+
friendsConnection(first: $first) {
145+
totalCount
146+
edges {
147+
node {
148+
name
149+
}
150+
}
151+
}
152+
}
153+
```
127154

128155
## 操作名称(Operation name)
129156

site/learn/Learn-Schema.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ GraphQL 服务可以用任何语言编写,因为我们并不依赖于任何特
4242
```graphql
4343
type Character {
4444
name: String!
45-
appearsIn: [Episode]!
45+
appearsIn: [Episode!]!
4646
}
4747
```
4848

@@ -52,7 +52,7 @@ type Character {
5252
- `name` 和 `appearsIn` 是 `Character` 类型上的**字段**。这意味着在一个操作 `Character` 类型的 GraphQL 查询中的任何部分,都只能出现 `name` 和 `appearsIn` 字段。
5353
- `String` 是内置的**标量**类型之一 —— 标量类型是解析到单个标量对象的类型,无法在查询中对它进行次级选择。后面我们将细述标量类型。
5454
- `String!` 表示这个字段是**非空的**,GraphQL 服务保证当你查询这个字段后总会给你返回一个值。在类型语言里面,我们用一个感叹号来表示这个特性。
55-
- `[Episode]!` 表示一个 `Episode` **数组**。因为它也是**非空的**,所以当你查询 `appearsIn` 字段的时候,你也总能得到一个数组(零个或者多个元素)。
55+
- `[Episode!]!` 表示一个 `Episode` **数组**。因为它也是**非空的**,所以当你查询 `appearsIn` 字段的时候,你也总能得到一个数组(零个或者多个元素)。且由于 `Episode!` 也是**非空的**,你总是可以预期到数组中的每个项目都是一个 `Episode` 对象
5656

5757
现在你知道一个 GraphQL 对象类型看上去是怎样,也知道如何阅读基础的 GraphQL 类型语言了。
5858

site/users/index.html.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,17 @@ var logos = [
655655
name: 'UC Trends',
656656
img: 'uctrends.png',
657657
link: 'https://trends.ucweb.com'
658-
}
658+
},
659+
{
660+
name: 'Expert360',
661+
img: 'expert360.png',
662+
link: 'https://expert360.com'
663+
},
664+
{
665+
name: 'Cloverleaf',
666+
img: 'cloverleaf.png',
667+
link: 'https://cloverleaf.me/'
668+
},
659669
// Adding your logo?
660670
// Add it to the /users/logos/ directory and then append an entry above this comment.
661671
//

site/users/logos/cloverleaf.png

12.3 KB
Loading

site/users/logos/expert360.png

7.18 KB
Loading

0 commit comments

Comments
 (0)