Skip to content

Commit a630e4f

Browse files
committed
Update README.md
1 parent 71986d1 commit a630e4f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ The default is `warn`.
127127
## Query documents with multiple operations
128128

129129
You can write multiple operations in one query document (one `.graphql` file). You can then select one by naming the struct you `#[derive(GraphQLQuery)]` on with the same name as one of the operations. This is neat, as it allows sharing fragments between operations.
130+
If you want to name the struct different from query name, you can use ``selected_operation`` argument like this.
131+
132+
#[derive(GraphQLQuery)]
133+
#[graphql(
134+
schema_path = "src/graphql/schema.json",
135+
query_path = "src/graphql/queries/my_query.graphql",
136+
selected_operation = "SearchQuery"
137+
)]
138+
pub struct MyQuery;
130139

131140
There is an example [in the tests](./tests/operation_selection).
132141

0 commit comments

Comments
 (0)