Trait async_graphql::context::DataContext
source · pub trait DataContext<'a> {
// Required methods
fn data<D: Any + Send + Sync>(&self) -> Result<&'a D>;
fn data_unchecked<D: Any + Send + Sync>(&self) -> &'a D;
fn data_opt<D: Any + Send + Sync>(&self) -> Option<&'a D>;
}Expand description
Data related functions of the context.
Required Methods§
sourcefn data<D: Any + Send + Sync>(&self) -> Result<&'a D>
fn data<D: Any + Send + Sync>(&self) -> Result<&'a D>
Gets the global data defined in the Context or Schema.
If both Schema and Query have the same data type, the data in the
Query is obtained.
Errors
Returns a Error if the specified type data does not exist.