Struct diana::DianaHandler[][src]

pub struct DianaHandler<C, Q, M, S> where
    C: Any + Send + Sync + Clone,
    Q: Clone + ObjectType + 'static,
    M: Clone + ObjectType + 'static,
    S: Clone + SubscriptionType + 'static, 
{ pub opts: Options<C, Q, M, S>, pub schema_without_subscriptions: Schema<Q, M, EmptySubscription>, pub schema_for_subscriptions: Schema<SubscriptionQuery, PublishMutation, S>, }
Expand description

The core logic primitive that underlies Diana’s systems. You should only use this if you need to support a platform other than the ones Diana has pre-built systems for (see the book). This is a struct so as to allow the caching of data that stay the same across requests, like the parsed and built schemas.

Fields

opts: Options<C, Q, M, S>

The options parsed in to the handler in ::new().You should only need to touch this if you’re building a custom integration.

schema_without_subscriptions: Schema<Q, M, EmptySubscription>

The schema created for the queries/mutations system. This has the user’s given query and mutation roots and no subscriptions at all. You should only need to touch this if you’re building a custom integration.

schema_for_subscriptions: Schema<SubscriptionQuery, PublishMutation, S>

The schema created for the subscriptions server. This has the user’s given subscription root and internally used query/mutation roots for communication with the query/mutation system. You should only need to touch this if you’re building a custom integration.

Implementations

Creates a new instance of the handler with the given options.

Determines ahead of time whether or not a request is authenticated. This should be used in middleware if possible so we can avoid sending full payloads if the auth token isn’t even valid. This just takes the HTTP Authorization header and returns an AuthVerdict.

Runs a query or mutation (stateless) given the request body and the value of the HTTP Authorization header. This performs authorisation checks and runs the actual request. If you’ve already used .is_authed() to obtain an AuthVerdict, this can be provided as the third argument to avoid running auth checks twice. This will return a DianaResponse no matter what, which simplifies error handling significantly. This function is for the subscriptions system only.

Runs a query or mutation (stateless) given the request body and the value of the HTTP Authorization header. This performs authorisation checks and runs the actual request. If you’ve already used .is_authed() to obtain an AuthVerdict, this can be provided as the third argument to avoid running auth checks twice. This will return a DianaResponse no matter what, which simplifies error handling significantly. This function is for the queries/mutations system only.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.