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" // ES6var { graphql } = require("graphql") // CommonJS
英:Overview
入口点
英:Entry Point
结构
英:Schema
类型定义
英:Type Definitions
class GraphQLScalarTypeGraphQL 中的标量类型。
class GraphQLObjectTypeAn object type within GraphQL that contains fields.
class GraphQLInterfaceTypeAn interface type within GraphQL that defines fields implementations will contain.
class GraphQLUnionTypeA union type within GraphQL that defines a list of implementations.
class GraphQLEnumTypeAn enum type within GraphQL that defines a list of valid values.
class GraphQLInputObjectTypeAn input object type within GraphQL that represents structured inputs.
class GraphQLListA type wrapper around other types that represents a list of those types.
class GraphQLNonNullA type wrapper around other types that represents a non-null version of those types.
标量
英:Scalars
错误
英:Errors
英:Entry Point
graphql( schema: GraphQLSchema, requestString: string, rootValue?: ?any, contextValue?: ?any, variableValues?: ?{[key: string]: any}, operationName?: ?string): Promise<GraphQLResult>
graphql
函数对 GraphQL 请求进行词法分析、解析、验证和执行。它需要 schema
和 requestString
。可选参数包括 rootValue
,它将作为根值传递给执行器;contextValue
,它将传递给所有解析函数;variableValues
,它将传递给执行器,为 requestString
和 operationName
中的任何变量提供值。 ,它允许调用者指定在 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
参见 类型系统 API 参考。
英:See the Type System API Reference.
英:Type Definitions
参见 类型系统 API 参考。
英:See the Type System API Reference.
英:Scalars
参见 类型系统 API 参考。
英:See the Type System API Reference.
英:Errors
参见 错误 API 参考
英:See the Errors API Reference