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(
|
return await executeQuery(
|
||||||
document, operation, schema, coercedVariableValues, initialValue);
|
document, operation, schema, coercedVariableValues, initialValue);
|
||||||
else {
|
else {
|
||||||
throw new UnimplementedError('mutations');
|
return executeMutation(
|
||||||
// return executeMutation(
|
document, operation, schema, coercedVariableValues, initialValue);
|
||||||
// document, operation, schema, coercedVariableValues, initialValue);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +172,23 @@ class GraphQL {
|
||||||
document, selectionSet, queryType, initialValue, variableValues);
|
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(
|
Future<Map<String, dynamic>> executeSelectionSet(
|
||||||
DocumentContext document,
|
DocumentContext document,
|
||||||
SelectionSetContext selectionSet,
|
SelectionSetContext selectionSet,
|
||||||
|
|
Loading…
Reference in a new issue