【发布时间】:2016-01-24 06:17:47
【问题描述】:
在 Relay/GraphQL 架构配置中,一对多关系(带分页)在 tutorial example 中指定
type ShipConnection {
edges: [ShipEdge]
pageInfo: PageInfo!
}
type ShipEdge {
cursor: String!
node: Ship
}
但是,ShipEdge 建立的一对一连接似乎是多余的。为什么我们不能将光标移动到ShipConnection 并将Ship ID 的数组存储为边?
type ShipConnection {
edges: [Ship]
pageInfo: PageInfo!
cursor: String!
}
在一对多关系中,每个edge 需要一个额外对象的设计决策是什么?
【问题讨论】: