[−][src]Trait async_graphql_tide::RequestExt
Tide request extension
Required methods
#[must_use]fn graphql_opts<'async_trait, Query, Mutation, Subscription, F>(
self,
schema: Schema<Query, Mutation, Subscription>,
query_builder_configuration: F,
opts: IntoQueryBuilderOpts
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>> where
Query: ObjectType + Send + Sync + 'static,
Mutation: ObjectType + Send + Sync + 'static,
Subscription: SubscriptionType + Send + Sync + 'static,
State: Send + Sync + 'static,
F: Fn(QueryBuilder) -> QueryBuilder + Send,
Query: 'async_trait,
Mutation: 'async_trait,
Subscription: 'async_trait,
F: 'async_trait,
Self: 'async_trait,
self,
schema: Schema<Query, Mutation, Subscription>,
query_builder_configuration: F,
opts: IntoQueryBuilderOpts
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>> where
Query: ObjectType + Send + Sync + 'static,
Mutation: ObjectType + Send + Sync + 'static,
Subscription: SubscriptionType + Send + Sync + 'static,
State: Send + Sync + 'static,
F: Fn(QueryBuilder) -> QueryBuilder + Send,
Query: 'async_trait,
Mutation: 'async_trait,
Subscription: 'async_trait,
F: 'async_trait,
Self: 'async_trait,
Similar to graphql, but you can set the options IntoQueryBuilderOpts
.
Provided methods
#[must_use]fn graphql<'async_trait, Query, Mutation, Subscription, F>(
self,
schema: Schema<Query, Mutation, Subscription>,
query_builder_configuration: F
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>> where
Query: ObjectType + Send + Sync + 'static,
Mutation: ObjectType + Send + Sync + 'static,
Subscription: SubscriptionType + Send + Sync + 'static,
State: Send + Sync + 'static,
F: Fn(QueryBuilder) -> QueryBuilder + Send,
Query: 'async_trait,
Mutation: 'async_trait,
Subscription: 'async_trait,
F: 'async_trait,
Self: Send + 'async_trait,
self,
schema: Schema<Query, Mutation, Subscription>,
query_builder_configuration: F
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>> where
Query: ObjectType + Send + Sync + 'static,
Mutation: ObjectType + Send + Sync + 'static,
Subscription: SubscriptionType + Send + Sync + 'static,
State: Send + Sync + 'static,
F: Fn(QueryBuilder) -> QueryBuilder + Send,
Query: 'async_trait,
Mutation: 'async_trait,
Subscription: 'async_trait,
F: 'async_trait,
Self: Send + 'async_trait,
use async_graphql::*; use async_std::task; use tide::Request; use async_graphql_tide::RequestExt as _; struct QueryRoot; #[Object] impl QueryRoot { #[field(desc = "Returns the sum of a and b")] async fn add(&self, a: i32, b: i32) -> i32 { a + b } } fn main() -> std::result::Result<(), Box<dyn std::error::Error + Send + Sync>> { task::block_on(async { let mut app = tide::new(); app.at("/").post(|req: Request<()>| async move { let schema = Schema::build(QueryRoot, EmptyMutation, EmptySubscription).finish(); req.graphql(schema, |query_builder| query_builder).await }); app.listen("0.0.0.0:8000").await?; Ok(()) }) }
Implementations on Foreign Types
impl<State> RequestExt<State> for Request<State>
[src]
fn graphql_opts<'async_trait, Query, Mutation, Subscription, F>(
self,
schema: Schema<Query, Mutation, Subscription>,
query_builder_configuration: F,
opts: IntoQueryBuilderOpts
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>> where
Query: ObjectType + Send + Sync + 'static,
Mutation: ObjectType + Send + Sync + 'static,
Subscription: SubscriptionType + Send + Sync + 'static,
State: Send + Sync + 'static,
F: Fn(QueryBuilder) -> QueryBuilder + Send,
Query: 'async_trait,
Mutation: 'async_trait,
Subscription: 'async_trait,
F: 'async_trait,
Self: 'async_trait,
[src]
self,
schema: Schema<Query, Mutation, Subscription>,
query_builder_configuration: F,
opts: IntoQueryBuilderOpts
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>> where
Query: ObjectType + Send + Sync + 'static,
Mutation: ObjectType + Send + Sync + 'static,
Subscription: SubscriptionType + Send + Sync + 'static,
State: Send + Sync + 'static,
F: Fn(QueryBuilder) -> QueryBuilder + Send,
Query: 'async_trait,
Mutation: 'async_trait,
Subscription: 'async_trait,
F: 'async_trait,
Self: 'async_trait,