跳至正文
Wener Notes

relay

约 1 分钟阅读
graphql
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 条
其他外链1 条
最近更新commit b441539编辑