如何解决筛选PHP Lighthouse GraphQL中方法的返回值
我有一个GraphQL查询findRecipe
,它返回一个口才模型recipe
的数组,该数组也在模式中定义。 recipe
有一个名为is_special_recipe
的字段,它不是数据库中的列,而是由方法计算出的值。如何在is_special_recipe
查询中过滤findRecipe
?
searchRecipe(
name: String @where(operator: "LIKE")
cooking_time_min: Int @where(operator: ">=")
cooking_time_max: Int @where(operator: "<=")
is_special_recipe: Boolean @where(operator: "eq")
): [Recipe] @paginate
type Recipe {
id: ID!
name: String!
image: String
description: String
cooking_time_min: Int
cooking_time_max: Int
is_special_recipe: Boolean @method(name: "isSpecialRecipe")
}
public function isSpecialRecipe()
{
//some logic
return false || true;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。