放大/DynamoDB 请求数据表,过滤多对多关系

问题描述

我尝试请求过滤多对多关系的表,但在放大 graphql 或 dynamoDB 上似乎不可能。

我有三个带有关系的表。品牌、主题、产品类型。

我的问题是:如何通过 topicId 和 ProductTypeID 过滤来选择所有品牌?

不管是什么解决方案,dynamoDb sdk,elastic @searchable 数据,在 dynamo db,partiQL 上扫描,直接在 graphql 解析器上。不管我拿什么。

这里是我的 graphql 架构:

type Topic @model
  @key(name: "topicByName",fields: ["name"])
  @searchable
{
  id: ID!
  name: String!
  color: String
  icon: String
  brands: [BrandTopic] @connection(keyName: "byTopic",fields: ["id"])
}

type BrandTopic @model
  @key(name: "byTopic",fields: ["topicID","brandID"])
  @key(name: "byBrand",fields: ["brandID","topicID"])
{
  id: ID!
  topicID: ID!
  brandID: ID!
  topic: Topic! @connection(fields: ["topicID"])
  brand: Brand! @connection(fields: ["brandID"])
}

type ProductType @model
  @key(name: "productTypesByName",fields: ["name"])
  @searchable
{
  id: ID!
  name: String!
  color: String
  icon: String
  brands: [BrandProductType] @connection(keyName: "byProductType",fields: ["id"])
}

type BrandProductType @model(queries: null)
  @key(name: "byProductType",fields: ["productTypeID","productTypeID"])
{
  id: ID!
  productTypeID: ID!
  brandID: ID!
  productType: ProductType! @connection(fields: ["productTypeID"])
  brand: Brand! @connection(fields: ["brandID"])
}

type Brand @model
  @key(name: "ByName",fields: ["name"])
  @searchable
{
  id: ID!
  name: String!
  link: String
  image: String
  bio: String
  topics: [BrandTopic] @connection(keyName: "byBrand",fields: ["id"])
  productTypes: [BrandProductType] @connection(keyName: "byBrand",fields: ["id"])
  createdAt: AWSDateTime! #important to keep it to have filter with keys
  updatedAt: AWSDateTime! #important to keep it to have filter with keys
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...