码迷,mamicode.com
首页 > 其他好文 > 详细

[GraphQL] Filter Data Based on Query Arguments with GraphQL

时间:2019-01-13 02:01:58      阅读:288      评论:0      收藏:0      [点我收藏+]

标签:图片   into   xxx   fun   can   field   span   src   evel   

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

标签:图片   into   xxx   fun   can   field   span   src   evel   

原文地址:https://www.cnblogs.com/Answer1215/p/10261446.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!