Reputation: 3055
Currently, I'm learning sangria-graphql from here. However, I could not find any documentation for Mutation (Add, Update, Delete). Also, google won't help me much. So, can you guys provide me with any good resources?
Upvotes: 2
Views: 1510
Reputation: 26566
Mutations in GraphQL are modeled as an object type, just like the Query
type. GraphQL schema has 3 top-level entry points which are modeled as object types:
Query
type - the root for the queriesMutation
type - the root for the mutationsSubscription
type - the root for the subscriptionsWhen you created the scheme, you can provide all 3 of them:
Schema(QueryType, Some(MutationType), Some(SubscriptionType))
Otherwise, mutations work very similar to queries, except that the mutation top-level fields are executed sequentially (guaranteed not to execute in parallel).
For further info and examples, I would recommend you to check sangria-subscriptions-example which demonstrates mutation and subscriptions in addition to normal queries. I would suggest you to start at schema definition:
Upvotes: 6