pub struct SchemaBuilder<Query, Mutation, Subscription> { /* private fields */ }
Expand description
Schema builder
Implementations§
Source§impl<Query, Mutation, Subscription> SchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> SchemaBuilder<Query, Mutation, Subscription>
Sourcepub fn register_input_type<T>(
self,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: InputType,
pub fn register_input_type<T>(
self,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: InputType,
Manually register a input type in the schema.
You can use this function to register schema types that are not directly referenced.
Sourcepub fn register_output_type<T>(
self,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: OutputType,
pub fn register_output_type<T>(
self,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: OutputType,
Manually register a output type in the schema.
You can use this function to register schema types that are not directly referenced.
Sourcepub fn disable_introspection(
self,
) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn disable_introspection( self, ) -> SchemaBuilder<Query, Mutation, Subscription>
Disable introspection queries.
Sourcepub fn limit_complexity(
self,
complexity: usize,
) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn limit_complexity( self, complexity: usize, ) -> SchemaBuilder<Query, Mutation, Subscription>
Set the maximum complexity a query can have. By default, there is no limit.
Sourcepub fn limit_depth(
self,
depth: usize,
) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn limit_depth( self, depth: usize, ) -> SchemaBuilder<Query, Mutation, Subscription>
Set the maximum depth a query can have. By default, there is no limit.
Sourcepub fn extension(
self,
extension: impl ExtensionFactory,
) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn extension( self, extension: impl ExtensionFactory, ) -> SchemaBuilder<Query, Mutation, Subscription>
Add an extension to the schema.
§Examples
use async_graphql::*;
struct Query;
#[Object]
impl Query {
async fn value(&self) -> i32 {
100
}
}
let schema = Schema::build(Query, EmptyMutation,EmptySubscription)
.extension(extensions::Logger)
.finish();
Sourcepub fn data<D>(self, data: D) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn data<D>(self, data: D) -> SchemaBuilder<Query, Mutation, Subscription>
Add a global data that can be accessed in the Schema
. You access it with Context::data
.
Sourcepub fn validation_mode(
self,
validation_mode: ValidationMode,
) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn validation_mode( self, validation_mode: ValidationMode, ) -> SchemaBuilder<Query, Mutation, Subscription>
Set the validation mode, default is ValidationMode::Strict
.
Sourcepub fn enable_federation(self) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn enable_federation(self) -> SchemaBuilder<Query, Mutation, Subscription>
Enable federation, which is automatically enabled if the Query has least one entity definition.
Sourcepub fn enable_subscription_in_federation(
self,
) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn enable_subscription_in_federation( self, ) -> SchemaBuilder<Query, Mutation, Subscription>
Make the Federation SDL include subscriptions.
Note: Not included by default, in order to be compatible with Apollo Server.
Sourcepub fn override_input_type_description<T>(
self,
desc: &'static str,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: InputType,
pub fn override_input_type_description<T>(
self,
desc: &'static str,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: InputType,
Override the name of the specified input type.
Sourcepub fn override_output_type_description<T>(
self,
desc: &'static str,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: OutputType,
pub fn override_output_type_description<T>(
self,
desc: &'static str,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: OutputType,
Override the name of the specified output type.
Sourcepub fn directive<T>(
self,
directive: T,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: CustomDirectiveFactory,
pub fn directive<T>(
self,
directive: T,
) -> SchemaBuilder<Query, Mutation, Subscription>where
T: CustomDirectiveFactory,
Register a custom directive.
§Panics
Panics if the directive with the same name is already registered.
Auto Trait Implementations§
impl<Query, Mutation, Subscription> Freeze for SchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> !RefUnwindSafe for SchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> Send for SchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> Sync for SchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> Unpin for SchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> !UnwindSafe for SchemaBuilder<Query, Mutation, Subscription>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more