我正在构建一个graphql应用程序,其中User
可以有一堆Entries
。这是一个n到m的关系,中间表/边缘持有关于关系的附加信息。 我graphql模式看起来是这样的:建模继电器光标连接
type User {
id: ID!,
entries(…): [UserEntry]
}
type UserEntry {
id: ID!,
user: User,
entry: Entry,
someOtherAttribute: String,
yetAnotherAttribute: String
}
type Entry {...}
type Query {
me: User!
userEntry(userEntryId: ID!): UserEntry!
}
我想光标样式分页添加到entries
领域,继Relay Cursor Connections Specification。 所以我想UserEntry
会变成这样的事情:
type UserEntryEdge {
node: Entry,
cursor: String,
someOtherAttribute: String,
yetAnotherEdgeAttribute: String
}
但我想还是能够直接查询UserEntry
/UserEntryEdge
,并在这方面例如cursor
领域将是无关紧要的。
设计我的graphql模式以便能够直接查询边缘数据的最佳方式是什么?
(FYI:我使用的是和的NodeJS阿波罗框架套件上都服务器和客户端)
所以你想直接查询'Entry'?你直接**下的含义是什么?你能否提供你想要的示例查询? – RomanHotsiy
我可以在这里查询'Entry'就好了。我想能够仍然查询UserEntry!我添加了当前查询的定义。 谢谢 – kombucha