-
Notifications
You must be signed in to change notification settings - Fork 436
Closed
Description
I have few questions many of them are more so due to the fact I having some difficulty flowing the flow of the crate.
- How do arguments work and how do I parse them?
For example, the graphql docs gives the example
query DroidById($id: ID!) {
droid(id: $id) {
name
}
}
{
id: [1,2] // lets pretend r2d2 and 3cpo are id 1 and 2
}
I can see that there is an argument struct so would I pass them in like so?
graphql_object!(<'a> &'a Droid: Database as "Droid" |&self| {
description: "A mechanical creature in the Star Wars universe."
interfaces: [&Character]
field id(id: juniper::Arguments) -> &str as "The id of the droid" {
self.id()
}
...
Given a list of the above do I have expose two different Query Roots? One for Droids and the other Driod? That is, if we changed the Query root to
graphql_object!(Database: Database as "Query" |&self| {
...
field droid(
id: String as "id of the droid"
) -> Option<&Vec<Droid>> {
self.get_droid(&id)
}
...
Which I guess would work if the get_droid method returned Option<&Vec> and rustc would serialize it.
My apologies for these basic questions, but it just not clicking for me. 😞
Metadata
Metadata
Assignees
Labels
No labels