GraphQL LogoGraphQL 中文网

graphql

graphql 模块导出 GraphQL 功能的核心子集,用于创建 GraphQL 类型系统和服务器。

英:The graphql module exports a core subset of GraphQL functionality for creation of GraphQL type systems and servers.

import { graphql } from "graphql" // ES6
var { graphql } = require("graphql") // CommonJS

概述(Overview)#

英:Overview

入口点

英:Entry Point

结构

英:Schema

类型定义

英:Type Definitions

标量

英:Scalars

错误

英:Errors

入口点(Entry Point)#

英:Entry Point

graphql(graphql)#

graphql(
schema: GraphQLSchema,
requestString: string,
rootValue?: ?any,
contextValue?: ?any,
variableValues?: ?{[key: string]: any},
operationName?: ?string
): Promise<GraphQLResult>

graphql 函数对 GraphQL 请求进行词法分析、解析、验证和执行。它需要 schemarequestString。可选参数包括 rootValue,它将作为根值传递给执行器;contextValue,它将传递给所有解析函数;variableValues,它将传递给执行器,为 requestStringoperationName 中的任何变量提供值。 ,它允许调用者指定在 requestString 包含多个顶层操作的情况下将运行 requestString 中的哪个操作。

英:The graphql function lexes, parses, validates and executes a GraphQL request. It requires a schema and a requestString. Optional arguments include a rootValue, which will get passed as the root value to the executor, a contextValue, which will get passed to all resolve functions, variableValues, which will get passed to the executor to provide values for any variables in requestString, and operationName, which allows the caller to specify which operation in requestString will be run, in cases where requestString contains multiple top-level operations.

结构(Schema)#

英:Schema

参见 类型系统 API 参考

英:See the Type System API Reference.

类型定义(Type Definitions)#

英:Type Definitions

参见 类型系统 API 参考

英:See the Type System API Reference.

标量(Scalars)#

英:Scalars

参见 类型系统 API 参考

英:See the Type System API Reference.

错误(Errors)#

英:Errors

参见 错误 API 参考

英:See the Errors API Reference

继续阅读 →graphql/错误
GraphQL 中文网 - 粤ICP备13048890号