Skip to content

Commit 2877c5b

Browse files
XatMassacrEjonirrings
authored andcommitted
APIReference-Execution.md (xitu#57)
* Finish basic translate version * Revise as reviewer suggestions * Finish translation
1 parent 48aafe5 commit 2877c5b

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

site/graphql-js/APIReference-Execution.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,27 @@ sublinks: execute
77
next: /graphql-js/language/
88
---
99

10-
The `graphql/execution` module is responsible for the execution phase of
11-
fulfilling a GraphQL request. You can import either from the `graphql/execution` module, or from the root `graphql` module. For example:
10+
`graphql/execution` 模块负责完成一个 GraphQL 请求的执行阶段。你可以直接从 `graphql/execution` 模块导入,也可以从 `graphql` 这个根模块导入。举例来说就是这样:
1211

1312
```js
1413
import { execute } from 'graphql'; // ES6
1514
var { execute } = require('graphql'); // CommonJS
1615
```
1716

18-
## Overview
17+
## 概述
1918

2019
<ul class="apiIndex">
2120
<li>
2221
<a href="#execute">
2322
<pre>function execute</pre>
24-
Executes a GraphQL request on the provided schema.
23+
对给定的 schema 执行一个 GraphQL 请求。
2524
</a>
2625
</li>
2726
</ul>
2827

29-
## Execution
28+
## 执行
3029

31-
### execute
30+
### 执行
3231

3332
```js
3433
export function execute(
@@ -46,13 +45,10 @@ type ExecutionResult = {
4645
}
4746
```
4847
49-
Implements the "Evaluating requests" section of the GraphQL specification.
48+
上面的代码实现了 GraphQL 规范中“处理请求”的部分。
5049
51-
Returns a Promise that will eventually be resolved and never rejected.
50+
它会返回一个最终一定会被 resolve 而不会被 reject 的 Promise。
5251
53-
If the arguments to this function do not result in a legal execution context,
54-
a GraphQLError will be thrown immediately explaining the invalid input.
52+
如果这个函数的参数造成了一个非法的执行上下文,那么马上就会有一个 GraphQLError 被抛出,这个错误将会解释非法输入的具体信息。
5553
56-
`ExecutionResult` represents the result of execution. `data` is the result of
57-
executing the query, `errors` is null if no errors occurred, and is a
58-
non-empty array if an error occurred.
54+
`ExecutionResult` 代表执行的结果。`data` 是执行查询语句的结果,`errors` 在没有错误发生时为空,在有错误发生时为一个非空的数组。

0 commit comments

Comments
 (0)