#[derive(MergedSubscription)]
{
    // Attributes available to this derive:
    #[graphql]
}
Expand description

Define a merged subscription with multiple subscription types.

See also the Book.

Macro attributes

AttributedescriptionTypeOptional
nameObject namestringY
name_typeIf true, the object name will be specified from async_graphql::TypeName traitboolY
extendsAdd fields to an entity that’s defined in another serviceboolY
visibleIf false, it will not be displayed in introspection. See also the Book.boolY
visibleCall the specified function. If the return value is false, it will not be displayed in introspection.stringY

Examples

use async_graphql::*;
use futures_util::stream::Stream;

#[derive(Default)]
struct Subscription1;

#[Subscription]
impl Subscription1 {
    async fn events1(&self) -> impl Stream<Item = i32> {
        futures_util::stream::iter(0..10)
    }
}

#[derive(Default)]
struct Subscription2;

#[Subscription]
impl Subscription2 {
    async fn events2(&self) -> impl Stream<Item = i32> {
        futures_util::stream::iter(10..20)
   }
}

#[derive(MergedSubscription, Default)]
struct Subscription(Subscription1, Subscription2);