-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Edges defined in Trustfall schemas may take parameters, for example: ```graphql type NewsWebsite { latest_stories(count: Int!): [Story!]! } ``` This trait can be used to deserialize [`&EdgeParameters`](crate::ir::EdgeParameters) into a struct specific to the parameters of that edge: ```rust struct LatestStoriesParameters { count: usize } ``` For example: ```rust use trustfall_core::TryIntoStruct; fn resolve_latest_stories(contexts: ContextIterator<Vertex>, parameters: &EdgeParameters) { let parameters: LatestStoriesParameters = parameters .try_into_struct() .expect("edge parameters did not match struct definition"); let count = parameters.count; // then resolve the edge with the given count } ``` Resolves #343.
- Loading branch information
1 parent
269ae7d
commit bbade61
Showing
3 changed files
with
97 additions
and
13 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