libgraphql_core/operation/
mutation.rs1use crate::ast;
2use crate::DirectiveAnnotation;
3use crate::loc;
4use crate::operation::FragmentRegistry;
5use crate::operation::MutationBuilder;
6use crate::operation::MutationBuildError;
7use crate::operation::OperationTrait;
8use crate::operation::OperationData;
9use crate::operation::SelectionSet;
10use crate::operation::Variable;
11use crate::schema::Schema;
12use indexmap::IndexMap;
13use inherent::inherent;
14
15#[derive(Clone, Debug, PartialEq)]
17pub struct Mutation<'schema: 'fragreg, 'fragreg>(
18 pub(super) OperationData<'schema, 'fragreg>,
19);
20
21#[inherent]
22impl<'schema: 'fragreg, 'fragreg> OperationTrait<
23 'schema,
24 'fragreg,
25 ast::operation::Mutation,
26 MutationBuildError,
27 MutationBuilder<'schema, 'fragreg>,
28> for Mutation<'schema, 'fragreg> {
29 pub fn builder(
31 schema: &'schema Schema,
32 fragment_registry: &'fragreg FragmentRegistry<'schema>,
33 ) -> MutationBuilder<'schema, 'fragreg> {
34 MutationBuilder::new(schema, fragment_registry)
35 }
36
37 pub fn directives(&self) -> &Vec<DirectiveAnnotation> {
39 &self.0.directives
40 }
41
42 pub fn def_location(&self) -> &loc::SourceLocation {
45 &self.0.def_location
46 }
47
48 pub fn name(&self) -> Option<&str> {
50 self.0.name.as_deref()
51 }
52
53 pub fn selection_set(&self) -> &SelectionSet<'fragreg> {
55 &self.0.selection_set
56 }
57
58 pub fn variables(&self) -> &IndexMap<String, Variable> {
60 &self.0.variables
61 }
62}