美文网首页
GraphQL - Queries and Mutations

GraphQL - Queries and Mutations

作者: 黑知更鸟 | 来源:发表于2017-08-15 14:25 被阅读0次

Fields

GraphQL queries look the same for both single items or list of items.

Arguments

In GraphQL, every field and nested object can get its own set of arguments. You can even pass arguments into scalar fields.

Aliases

Alias let you rename the result of a field to anything you want.

Fregments

Fregments let you construct sets of fields, and then include them in queries where you need.

Variables

GraphQL has a first-class way to factor dynamic values out of the query, and pass them as a seperate dictionary.

All declared variables must be either scalars, enums or input object types.
Variable definition can be optional or required. Since there isn't a ! next to the Episode type, it's optional.

Directives

A directive can be attached to a field or fragment inclusion.

The core GraphQL specification includes exactly two directives.

  • @include(if: Boolean)
  • @skip(if: Boolean)

Mutations

The review variable we passed in is an input object type.

While query fields are executed in parallel, mutation fields run in series, on after the other, ensuring that we don't end up with a race condition with ourselves.

Inline Fragments

If you are querying a field that returns a interface or a union type, you will need to use inline fragments to access data on the underlying concrete type.

Meta Fields

"__typename" is an meta field

相关文章

网友评论

      本文标题:GraphQL - Queries and Mutations

      本文链接:https://www.haomeiwen.com/subject/dwamrxtx.html