relay
约 1 分钟阅读
- GraphQL Server Specification
- graphql/graphql-relay-jsGitHubgraphql/graphql-relay-jsGraphQL Server Specification · graphql/graphql-relay-js笔记:relay
interface Node {
id: ID!
}
# Node 具体实现
type User implements Node {
id: ID!
name: String
}
type UserConnection {
edges: [UserEdge]
pageInfo: PageInfo!
}
type UserEdge {
cursor: String!
node: Ship
}
type PageInfo {
hasNextPage: Boolean!
hasPreviousPage: Boolean!
startCursor: String
endCursor: String
}
# 修改参数都在一个 input 里
type CreateUserInput {
# input 需要有 clientMutationId
clientMutationId: String
}
# 返回内容都为 Payload
type CreateUserPayload {
user: User
# 返回的 clientMutationId
clientMutationId: String
}
type Query {
findUserConnection: UserConnection
# 必须
node(id: ID!): Node
}
type Mutation {
createUser(input: CreateUserInput!): CreateUserPayload!
}关联信息
反向链接、本文链接的其他页面和外部资料。
参考资料
GitHub1 条
- graphql/graphql-relay-jsgithub.com/graphql/graphql-relay-js
其他外链1 条
- relay.dev/docs/guides/graphql-server-specificationrelay.dev/docs/guides/graphql-server-specification