Trait ContextQueriedFields

Source
pub trait ContextQueriedFields {
    // Required method
    fn queried_fields(&self) -> QueriedFields;
}
Expand description

Trait to convert to a QueriedFields

Required Methods§

Source

fn queried_fields(&self) -> QueriedFields

Extracts the QueriedFields from the given context, skipping the current top-level field.

§Examples

Given the following query:

query {
  foo {
    a
    b
    bar {
      c
      d
    }
  }
}

The QueriedFields would contain different fields depending where it’s called:

  • In the foo resolver, ["a", "b", "bar.c", "bar.d"]
  • In the bar resolver within foo, ["c", "d"]

Implementations on Foreign Types§

Source§

impl ContextQueriedFields for &Context<'_>

Implementors§