Skip to content

Commit 9184e91

Browse files
committed
optimize Request::findOperationDefinition()
In our internal usages, there is no need to allocate the string, keep only the string_view to the operationType. Keep the old function, but mark as deprected.
1 parent 2586c89 commit 9184e91

File tree

4 files changed

+411
-538
lines changed

4 files changed

+411
-538
lines changed

doc/subscriptions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ tell which operation type it is without parsing the query and searching for
8383
a specific operation name, so it's hard to tell whether you should call
8484
`resolve` or `subscribe` when the request is received that way. To help with
8585
that, there's a public `Request::findOperationDefinition` method which returns
86-
the operation type as a `std::string` along with a pointer to the AST node for
86+
the operation type as a `std::string_view` along with a pointer to the AST node for
8787
the selected operation in the parsed query:
8888
```cpp
89-
std::pair<std::string, const peg::ast_node*> findOperationDefinition(const peg::ast_node& root, const std::string& operationName) const;
89+
std::pair<std::string_view, const peg::ast_node*> findOperationDefinition(peg::ast& root, std::string_view operationName) const;
9090
```

0 commit comments

Comments
 (0)