Download Code/GraphQL/09_query.graphql from zxy0307/Python_05_Flask: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/zxy0307/Python_05_Flask/resolve/main/Code/GraphQL/09_query.graphql
- Command line
-
hf download hf://zxy0307/Python_05_Flask/Code/GraphQL/09_query.graphql
-
curl -L -o 09_query.graphql https://huggingface.co/zxy0307/Python_05_Flask/resolve/main/Code/GraphQL/09_query.graphql
1.14 kB
| #1. select * from table id = "" | |
| { | |
| human(id:"1002"){ | |
| id | |
| name | |
| friends { | |
| id | |
| } | |
| appearsIn | |
| } | |
| } | |
| #2. select * from table t1 left join table t2 on t1.id = t2.friends_id | |
| { | |
| human(id:"1002"){ | |
| id | |
| name | |
| friends { | |
| id | |
| name | |
| } | |
| appearsIn | |
| } | |
| } | |
| #3. 别名的使用 | |
| { | |
| h1:human(id:"1002"){ | |
| id | |
| name | |
| homePlanet | |
| } | |
| h2:human(id:"1003"){ | |
| id | |
| name | |
| homePlanet | |
| } | |
| } | |
| #4. 字段的复用 | |
| { | |
| h1:human(id:"1002"){ | |
| ...hf | |
| } | |
| h2:human(id:"1003"){ | |
| ...hf | |
| } | |
| } | |
| fragment hf on Human{ | |
| id | |
| name | |
| homePlanet | |
| } | |
| #5. 获取接口特有数据 | |
| { | |
| hero(episode:EMPIRE){ | |
| id | |
| name | |
| friends { | |
| id | |
| } | |
| appearsIn | |
| ...on Droid{ | |
| primaryFunction | |
| } | |
| ...on Human{ | |
| homePlanet | |
| } | |
| } | |
| } | |
| # 给查询定义名称 | |
| query q1 { | |
| hero(episode:EMPIRE){ | |
| id | |
| name | |
| friends { | |
| id | |
| } | |
| appearsIn | |
| ...on Droid{ | |
| primaryFunction | |
| } | |
| ...on Human{ | |
| homePlanet | |
| } | |
| } | |
| } | |
| # 动态传递参数 | |
| query queryC($id:Episode){ | |
| hero(episode:$id){ | |
| name | |
| appearsIn | |
| } | |
| } | |
| {"episode":"JEDI"} #传递进去的参数 |