更新时间:2022-11-26 12:53:12
您绝对可以使用值数组进行查询!这是查询本身的样子:
You can definitely query with an array of values! Here's what the query itself would look like:
{
events(containsId: [1,2,3]) {
...
}
}
类型看起来像:
const eventsType = new GraphQLObjectType({
name: 'events',
type: // your type definition for events,
args: {
containsId: new GraphQLList(GraphQLID)
},
...
});
如果要参数化此查询,请参见以下示例:
If you wanted to parameterize this query, here's an example of that:
{
query: `
query events ($containsId: [Int]) {
events(containsId: $containsId) {
id
name
}
}
`,
variables: {
containsId: [1,2,3]
}
}