我想在“客户端”类型中解析一个名为“ outstandingBalance”的字段。如果是前端查询:
query {
Client {
id
name
outstandingBalance
}
}
outstandingBalance的解析器函数运行成本很高。如果是前端查询:
query {
Client {
id
name
}
}
然后,不要触发“ outstandingBalance”的解析器。我对graphql有基本的了解,并且阅读了its official document的大部分内容。但是还没有看到这种模式的答案,还是不允许使用Graphql的这种方式?
问题 graphql是否有一个称为“ Nont根级解析器”的东西?例如“客户类型”中的“ outstandingBalance”字段?
问题:如何在graphql中实现?尤其是使用解析器:
async function outstandingBalance(obj, args, context, info) {
console.log('called...')
}
根据是否查询此字段来查询一种类型的字段?