Struct simple_syrup::SchemaBuilder
source · [−]pub struct SchemaBuilder<Query, Mutation, Subscription> { /* private fields */ }Expand description
Schema builder
Implementations
sourceimpl<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> where
D: Any + Send + Sync,
pub fn data<D>(self, data: D) -> SchemaBuilder<Query, Mutation, Subscription> where
D: Any + Send + Sync,
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> !RefUnwindSafe for SchemaBuilder<Query, Mutation, Subscription>
impl<Query, Mutation, Subscription> Send for SchemaBuilder<Query, Mutation, Subscription> where
Mutation: Send,
Query: Send,
Subscription: Send,
impl<Query, Mutation, Subscription> Sync for SchemaBuilder<Query, Mutation, Subscription> where
Mutation: Sync,
Query: Sync,
Subscription: Sync,
impl<Query, Mutation, Subscription> Unpin for SchemaBuilder<Query, Mutation, Subscription> where
Mutation: Unpin,
Query: Unpin,
Subscription: Unpin,
impl<Query, Mutation, Subscription> !UnwindSafe for SchemaBuilder<Query, Mutation, Subscription>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more