Graphql @connection上的Appsync筛选列表
我有一个这样的模式Graphql @connection上的Appsync筛选列表,graphql,amazon-dynamodb,aws-amplify,aws-appsync,vtl,Graphql,Amazon Dynamodb,Aws Amplify,Aws Appsync,Vtl,我有一个这样的模式 type District @model { id: ID! name: String! workers: [Worker] @connection(name: "DistrictWorker") } type Service @model{ id: ID! name: String! workers: [Worker] @connection(name: "ServiceWorker") } type Worker @mode
type District @model {
id: ID!
name: String!
workers: [Worker] @connection(name: "DistrictWorker")
}
type Service @model{
id: ID!
name: String!
workers: [Worker] @connection(name: "ServiceWorker")
}
type Worker @model {
id: ID!
name: String!
service: Service @connection(name: "ServiceWorker")
district: District @connection(name: "DistrictWorker")
}
我想通过连接在工作者应用服务和/或地区过滤处查询。
我想我必须写一些自定义解析器,可能是流水线解析器,我想知道如何实现它
是否有任何不同的方法来实现相同的功能。可以通过将所需的筛选器字段添加到各自的
ModelFilterInput
来过滤连接上的查询。Amplify with Appsync通过生成解析器并根据我们定义的模式将它们连接到特定的表,从而完成了一项出色的工作。一、 想知道为什么为表生成的ModelFilterInput
不包含连接字段
对于上面定义的模式,我修改了生成的代码,如下所示:
input ModelWorkerFilterInput {
id: ModelIDFilterInput
name: ModelStringFilterInput
source: ModelStringFilterInput
phone: ModelStringFilterInput
workerServiceId: ModelStringFilterInput # added For @connection(name: "ServiceWorker")
workerDistrictId: ModelStringFilterInput # added For @connection(name: "DistrictWorker")
and: [ModelWorkerFilterInput]
or: [ModelWorkerFilterInput]
not: ModelWorkerFilterInput
}