从 blaze 查询到 GraphQL 查询的转换
Translation from blaze query to GraphQL query
我有一个数据消费者,它是一个 Jupyter Notebook。有什么方法可以将用 blaze 编写的查询转换为 graphQL 查询吗?
例如在 blaze 中我们有:
accounts[accounts.balance < 0].name
在 GraphQL 中我们可能有这样的:
{
accounts(balance<0)
{
name
}
}
GraphQL 不公开任何内置过滤功能。它可以以参数的形式手动实现。因此,根据您的需要,您可以定义查询字段,例如:
type Query {
accounts(balanceBelow: Int!): [Account!]
}
或:
type Constraint {
fieldName: String!
operator: OperatorEnum!
value: String!
}
type Query {
accounts(where: Constraint): [Account!]
}
或介于两者之间。但是,如果自定义查询过滤和聚合之类的东西在您的域中很常见,您可能会发现使用 GraphQL 是一种麻烦的选择。
我有一个数据消费者,它是一个 Jupyter Notebook。有什么方法可以将用 blaze 编写的查询转换为 graphQL 查询吗?
例如在 blaze 中我们有:
accounts[accounts.balance < 0].name
在 GraphQL 中我们可能有这样的:
{
accounts(balance<0)
{
name
}
}
GraphQL 不公开任何内置过滤功能。它可以以参数的形式手动实现。因此,根据您的需要,您可以定义查询字段,例如:
type Query {
accounts(balanceBelow: Int!): [Account!]
}
或:
type Constraint {
fieldName: String!
operator: OperatorEnum!
value: String!
}
type Query {
accounts(where: Constraint): [Account!]
}
或介于两者之间。但是,如果自定义查询过滤和聚合之类的东西在您的域中很常见,您可能会发现使用 GraphQL 是一种麻烦的选择。