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
入口点
¥Entry Point
结构
¥Schema
类型定义
¥Type Definitions
- class GraphQLScalarTypeGraphQL 中的标量类型。- ¥ - class GraphQLScalarTypeA scalar type within GraphQL.
- class GraphQLObjectTypeGraphQL 中包含字段的对象类型。- ¥ - class GraphQLObjectTypeAn object type within GraphQL that contains fields.
- class GraphQLInterfaceTypeGraphQL 中定义字段实现将包含的接口类型。- ¥ - class GraphQLInterfaceTypeAn interface type within GraphQL that defines fields implementations will contain.
- class GraphQLUnionTypeGraphQL 中的联合类型,定义实现列表。- ¥ - class GraphQLUnionTypeA union type within GraphQL that defines a list of implementations.
- class GraphQLEnumTypeGraphQL 中定义有效值列表的枚举类型。- ¥ - class GraphQLEnumTypeAn enum type within GraphQL that defines a list of valid values.
- class GraphQLInputObjectTypeGraphQL 中表示结构化输入的输入对象类型。- ¥ - class GraphQLInputObjectTypeAn input object type within GraphQL that represents structured inputs.
- class GraphQLList表示这些类型列表的其他类型的类型封装器。- ¥ - class GraphQLListA type wrapper around other types that represents a list of those types.
- class GraphQLNonNull表示这些类型的非空版本的其他类型的类型封装器。- ¥ - class GraphQLNonNullA type wrapper around other types that represents a non-null version of those types.
标量
¥Scalars
- var GraphQLInt表示整数的标量类型。- ¥ - var GraphQLIntA scalar type representing integers.
- var GraphQLFloat表示浮点数的标量类型。- ¥ - var GraphQLFloatA scalar type representing floats.
- var GraphQLString表示字符串的标量类型。- ¥ - var GraphQLStringA scalar type representing strings.
- var GraphQLBoolean表示布尔值的标量类型。- ¥ - var GraphQLBooleanA scalar type representing booleans.
- var GraphQLID表示 ID 的标量类型。- ¥ - var GraphQLIDA scalar type representing IDs.
错误
¥Errors
入口点
¥Entry Point
graphql
function 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