-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an iterator over all the required properties of a Vertex (#449)
* adding a vec of the vertex properties * test files * rust fmt * Update trustfall_core/test_data/tests/valid_queries/required_properties.graphql.ron Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com> * Update trustfall_core/src/interpreter/hints/vertex_info.rs Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com> * returning iterator instead of vec * remove edges from the iterator * simplify closure * flat_map instead of pure map followed by flatten * removing commented code * use HashSet internally instead of vec * uses filter_map * chain iterators * documentation * using vec instead of hashset for test * one more test covering duplicated properties and fold with transform * more docs * fix ilegal test * fix wording * exporting new struct * Update trustfall_core/src/interpreter/hints/vertex_info.rs --------- Co-authored-by: Predrag Gruevski <2348618+obi1kenobi@users.noreply.github.com>
- Loading branch information
1 parent
84a2b4a
commit f1b81aa
Showing
15 changed files
with
1,770 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 148 additions & 0 deletions
148
trustfall_core/test_data/tests/valid_queries/required_properties.graphql-parsed.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
Ok(TestParsedGraphQLQuery( | ||
schema_name: "numbers", | ||
query: Query( | ||
root_connection: FieldConnection( | ||
position: Pos( | ||
line: 3, | ||
column: 5, | ||
), | ||
name: "Number", | ||
arguments: { | ||
"max": Int64(2), | ||
"min": Int64(1), | ||
}, | ||
), | ||
root_field: FieldNode( | ||
position: Pos( | ||
line: 3, | ||
column: 5, | ||
), | ||
name: "Number", | ||
connections: [ | ||
(FieldConnection( | ||
position: Pos( | ||
line: 4, | ||
column: 9, | ||
), | ||
name: "__typename", | ||
), FieldNode( | ||
position: Pos( | ||
line: 4, | ||
column: 9, | ||
), | ||
name: "__typename", | ||
filter: [ | ||
FilterDirective( | ||
operation: Equals((), VariableRef("type")), | ||
), | ||
], | ||
)), | ||
(FieldConnection( | ||
position: Pos( | ||
line: 5, | ||
column: 9, | ||
), | ||
name: "value", | ||
), FieldNode( | ||
position: Pos( | ||
line: 5, | ||
column: 9, | ||
), | ||
name: "value", | ||
output: [ | ||
OutputDirective(), | ||
], | ||
)), | ||
(FieldConnection( | ||
position: Pos( | ||
line: 6, | ||
column: 9, | ||
), | ||
name: "name", | ||
), FieldNode( | ||
position: Pos( | ||
line: 6, | ||
column: 9, | ||
), | ||
name: "name", | ||
tag: [ | ||
TagDirective(), | ||
], | ||
)), | ||
(FieldConnection( | ||
position: Pos( | ||
line: 7, | ||
column: 9, | ||
), | ||
name: "predecessor", | ||
fold: Some(FoldGroup( | ||
fold: FoldDirective(), | ||
)), | ||
), FieldNode( | ||
position: Pos( | ||
line: 7, | ||
column: 9, | ||
), | ||
name: "predecessor", | ||
connections: [ | ||
(FieldConnection( | ||
position: Pos( | ||
line: 8, | ||
column: 13, | ||
), | ||
name: "name", | ||
), FieldNode( | ||
position: Pos( | ||
line: 8, | ||
column: 13, | ||
), | ||
name: "name", | ||
output: [ | ||
OutputDirective(), | ||
], | ||
)), | ||
], | ||
)), | ||
(FieldConnection( | ||
position: Pos( | ||
line: 10, | ||
column: 9, | ||
), | ||
name: "multiple", | ||
arguments: { | ||
"max": Int64(5), | ||
}, | ||
), FieldNode( | ||
position: Pos( | ||
line: 10, | ||
column: 9, | ||
), | ||
name: "multiple", | ||
connections: [ | ||
(FieldConnection( | ||
position: Pos( | ||
line: 11, | ||
column: 13, | ||
), | ||
name: "name", | ||
), FieldNode( | ||
position: Pos( | ||
line: 11, | ||
column: 13, | ||
), | ||
name: "name", | ||
filter: [ | ||
FilterDirective( | ||
operation: Equals((), TagRef("name")), | ||
), | ||
], | ||
)), | ||
], | ||
)), | ||
], | ||
), | ||
), | ||
arguments: { | ||
"type": String("Prime"), | ||
}, | ||
)) |
20 changes: 20 additions & 0 deletions
20
trustfall_core/test_data/tests/valid_queries/required_properties.graphql.ron
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
TestGraphQLQuery ( | ||
schema_name: "numbers", | ||
query: r#" | ||
{ | ||
Number(min: 1, max: 2) { | ||
__typename @filter(op: "=", value: ["$type"]) | ||
value @output | ||
name @tag | ||
predecessor @fold { | ||
name @output | ||
} | ||
multiple(max: 5) { | ||
name @filter(op: "=", value: ["%name"]) | ||
} | ||
} | ||
}"#, | ||
arguments: { | ||
"type": String("Prime"), | ||
}, | ||
) |
Oops, something went wrong.