Added executeMutation
This commit is contained in:
parent
d96470a62a
commit
0a1928cf26
1 changed files with 19 additions and 3 deletions
|
@ -94,9 +94,8 @@ class GraphQL {
|
|||
return await executeQuery(
|
||||
document, operation, schema, coercedVariableValues, initialValue);
|
||||
else {
|
||||
throw new UnimplementedError('mutations');
|
||||
// return executeMutation(
|
||||
// document, operation, schema, coercedVariableValues, initialValue);
|
||||
return executeMutation(
|
||||
document, operation, schema, coercedVariableValues, initialValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,6 +172,23 @@ class GraphQL {
|
|||
document, selectionSet, queryType, initialValue, variableValues);
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> executeMutation(
|
||||
DocumentContext document,
|
||||
OperationDefinitionContext mutation,
|
||||
GraphQLSchema schema,
|
||||
Map<String, dynamic> variableValues,
|
||||
initialValue) async {
|
||||
var mutationType = schema.mutation;
|
||||
|
||||
if (mutationType == null) {
|
||||
throw new GraphQLException.fromMessage('The schema does not define a mutation type.');
|
||||
}
|
||||
|
||||
var selectionSet = mutation.selectionSet;
|
||||
return await executeSelectionSet(
|
||||
document, selectionSet, mutationType, initialValue, variableValues);
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> executeSelectionSet(
|
||||
DocumentContext document,
|
||||
SelectionSetContext selectionSet,
|
||||
|
|
Loading…
Reference in a new issue