[GraphQL] Filter Data Based on Query Arguments with GraphQL
Posted answer1215
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[GraphQL] Filter Data Based on Query Arguments with GraphQL相关的知识,希望对你有一定的参考价值。
With GraphQL, every field and nested object can have a set of arguments which can be used to request very specific data from a GraphQL API. In this lesson, we will pass arguments to the GitHub API inline and as query variables.
We can named query:
query UserInfo {
}
We can pass in arguements into query:
query UserInfo ($login: String="xxx"){}
The same as function in javascript, we can give default params and use it in query:
query UserInfo ($login: String="xxx"){
user(login:$login) {
name,
company,
followers {
totalCount
}
}
}
以上是关于[GraphQL] Filter Data Based on Query Arguments with GraphQL的主要内容,如果未能解决你的问题,请参考以下文章
如何在 Connect 组件下的 graphql 查询中使用 $filter 变量?
使用 GraphQL +Ariadne + Flask 上传文件:graphql.error.graphql_error.GraphQLError: Operation data should be