Struct async_graphql::Schema
source · [−]pub struct Schema<Query, Mutation, Subscription>(_);
Expand description
GraphQL schema.
Cloning a schema is cheap, so it can be easily shared.
Implementations
sourceimpl<Query, Mutation, Subscription> Schema<Query, Mutation, Subscription>where
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
impl<Query, Mutation, Subscription> Schema<Query, Mutation, Subscription>where
Query: ObjectType + 'static,
Mutation: ObjectType + 'static,
Subscription: SubscriptionType + 'static,
sourcepub fn build(
query: Query,
mutation: Mutation,
subscription: Subscription
) -> SchemaBuilder<Query, Mutation, Subscription>
pub fn build(
query: Query,
mutation: Mutation,
subscription: Subscription
) -> SchemaBuilder<Query, Mutation, Subscription>
Create a schema builder
The root object for the query and Mutation needs to be specified.
If there is no mutation, you can use EmptyMutation
.
If there is no subscription, you can use EmptySubscription
.
sourcepub fn build_with_ignore_name_conflicts<I, T>(
query: Query,
mutation: Mutation,
subscription: Subscription,
ignore_name_conflicts: I
) -> SchemaBuilder<Query, Mutation, Subscription>where
I: IntoIterator<Item = T>,
T: Into<String>,
pub fn build_with_ignore_name_conflicts<I, T>(
query: Query,
mutation: Mutation,
subscription: Subscription,
ignore_name_conflicts: I
) -> SchemaBuilder<Query, Mutation, Subscription>where
I: IntoIterator<Item = T>,
T: Into<String>,
Create a schema builder and specifies a list to ignore type conflict detection.
NOTE: It is not recommended to use it unless you know what it does.
sourcepub fn new(
query: Query,
mutation: Mutation,
subscription: Subscription
) -> Schema<Query, Mutation, Subscription>
pub fn new(
query: Query,
mutation: Mutation,
subscription: Subscription
) -> Schema<Query, Mutation, Subscription>
Create a schema
sourcepub fn sdl_with_options(&self, options: SDLExportOptions) -> String
pub fn sdl_with_options(&self, options: SDLExportOptions) -> String
Returns SDL(Schema Definition Language) of this schema with options.
sourcepub fn names(&self) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn names(&self) -> Vec<String>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Get all names in this schema
Maybe you want to serialize a custom binary protocol. In order to minimize message size, a dictionary is usually used to compress type names, field names, directive names, and parameter names. This function gets all the names, so you can create this dictionary.
sourcepub async fn execute_batch(&self, batch_request: BatchRequest) -> BatchResponse
pub async fn execute_batch(&self, batch_request: BatchRequest) -> BatchResponse
Execute a GraphQL batch query.