github.com/dgraph-io/dgraph@v1.2.8/graphql/resolve/mutation_query_test.yaml (about) 1 ADD_UPDATE_MUTATION: 2 - 3 name: "single level" 4 gqlquery: | 5 mutation { 6 ADD_UPDATE_MUTATION { 7 post { 8 postID 9 title 10 } 11 } 12 } 13 dgquery: |- 14 query { 15 post(func: uid(0x4)) { 16 postID : uid 17 title : Post.title 18 dgraph.uid : uid 19 } 20 } 21 22 - 23 name: "with alias" 24 gqlquery: | 25 mutation { 26 ADD_UPDATE_MUTATION { 27 result : post { 28 postID 29 title 30 } 31 } 32 } 33 dgquery: |- 34 query { 35 result(func: uid(0x4)) { 36 postID : uid 37 title : Post.title 38 dgraph.uid : uid 39 } 40 } 41 42 - 43 name: "with field alias" 44 gqlquery: | 45 mutation { 46 ADD_UPDATE_MUTATION { 47 post { 48 id : postID 49 postTitle : title 50 } 51 } 52 } 53 dgquery: |- 54 query { 55 post(func: uid(0x4)) { 56 id : uid 57 postTitle : Post.title 58 dgraph.uid : uid 59 } 60 } 61 62 - 63 name: "selection set in result" 64 gqlquery: | 65 mutation { 66 ADD_UPDATE_MUTATION { 67 post (first: 0, offset: 10, order : {asc: title}, filter: { title: { anyofterms: "GraphQL" } }){ 68 postID 69 title 70 } 71 } 72 } 73 dgquery: |- 74 query { 75 post(func: uid(0x4), orderasc: Post.title, first: 0, offset: 10) @filter(anyofterms(Post.title, "GraphQL")) { 76 postID : uid 77 title : Post.title 78 dgraph.uid : uid 79 } 80 } 81 82 - 83 name: "deep" 84 gqlquery: | 85 mutation { 86 ADD_UPDATE_MUTATION { 87 post { 88 postID 89 title 90 author { 91 name 92 } 93 } 94 } 95 } 96 dgquery: |- 97 query { 98 post(func: uid(0x4)) { 99 postID : uid 100 title : Post.title 101 author : Post.author { 102 name : Author.name 103 dgraph.uid : uid 104 } 105 dgraph.uid : uid 106 } 107 } 108 109 - 110 name: "deep with alias" 111 gqlquery: | 112 mutation { 113 ADD_UPDATE_MUTATION { 114 post { 115 postID 116 title 117 postAuthor: author { 118 authorID: id 119 authorName: name 120 } 121 } 122 } 123 } 124 dgquery: |- 125 query { 126 post(func: uid(0x4)) { 127 postID : uid 128 title : Post.title 129 postAuthor : Post.author { 130 authorID : uid 131 authorName : Author.name 132 dgraph.uid : uid 133 } 134 dgraph.uid : uid 135 } 136 } 137 138 - 139 name: "can do deep filter" 140 gqlquery: | 141 mutation { 142 ADD_UPDATE_MUTATION { 143 post { 144 postID 145 title 146 author { 147 name 148 posts(filter: { title: { anyofterms: "GraphQL" } }) { 149 title 150 } 151 } 152 } 153 } 154 } 155 dgquery: |- 156 query { 157 post(func: uid(0x4)) { 158 postID : uid 159 title : Post.title 160 author : Post.author { 161 name : Author.name 162 posts : Author.posts @filter(anyofterms(Post.title, "GraphQL")) { 163 title : Post.title 164 dgraph.uid : uid 165 } 166 dgraph.uid : uid 167 } 168 dgraph.uid : uid 169 } 170 } 171 172 - 173 name: "can work with skip and filter" 174 variables: 175 skip: true 176 include: false 177 gqlquery: | 178 mutation ($skip: Boolean!, $include: Boolean!) { 179 ADD_UPDATE_MUTATION { 180 post { 181 postID @skip(if: $skip) 182 title 183 author @include(if: $include) { 184 name 185 posts(filter: { title: { anyofterms: "GraphQL" } }) { 186 title 187 } 188 } 189 } 190 } 191 } 192 dgquery: |- 193 query { 194 post(func: uid(0x4)) { 195 title : Post.title 196 dgraph.uid : uid 197 } 198 } 199 200 UPDATE_MUTATION: 201 - 202 name: "filter update result" 203 gqlquery: | 204 mutation { 205 UPDATE_MUTATION { 206 post(filter: { title: { anyofterms: "GraphQL" } }) { 207 postID 208 title 209 } 210 } 211 } 212 dgquery: |- 213 query { 214 post(func: uid(0x4)) @filter(anyofterms(Post.title, "GraphQL")) { 215 postID : uid 216 title : Post.title 217 dgraph.uid : uid 218 } 219 } 220 - 221 name: "order update result" 222 gqlquery: | 223 mutation { 224 UPDATE_MUTATION { 225 post(order : {asc: title}) { 226 postID 227 title 228 } 229 } 230 } 231 dgquery: |- 232 query { 233 post(func: uid(0x4), orderasc: Post.title) { 234 postID : uid 235 title : Post.title 236 dgraph.uid : uid 237 } 238 } 239 240 - 241 name: "order and pagination update result" 242 gqlquery: | 243 mutation { 244 UPDATE_MUTATION { 245 post(first: 0, offset: 10, order : {asc: title}) { 246 postID 247 title 248 } 249 } 250 } 251 dgquery: |- 252 query { 253 post(func: uid(0x4), orderasc: Post.title, first: 0, offset: 10) { 254 postID : uid 255 title : Post.title 256 dgraph.uid : uid 257 } 258 }