Struct async_graphql::dynamic::Object
source · pub struct Object { /* private fields */ }
Available on crate feature
dynamic-schema
only.Expand description
A GraphQL object type
Examples
use async_graphql::{dynamic::*, value, Value};
let query = Object::new("Query").field(Field::new("value", TypeRef::STRING, |ctx| {
FieldFuture::new(async move { Ok(Some(Value::from("abc"))) })
}));
let schema = Schema::build(query.type_name(), None, None)
.register(query)
.finish()?;
assert_eq!(
schema
.execute("{ value }")
.await
.into_result()
.unwrap()
.data,
value!({ "value": "abc" })
);
Implementations
sourceimpl Object
impl Object
sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set the description
sourcepub fn type_ref(&self) -> NamedTypeRefBuilder
pub fn type_ref(&self) -> NamedTypeRefBuilder
Returns the type reference
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Object
impl Send for Object
impl Sync for Object
impl Unpin for Object
impl !UnwindSafe for Object
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more