pub struct Node<RequestCtx> where
    RequestCtx: Debug + RequestContext
{ /* private fields */ }
Expand description

Represents a node in the graph data structure for auto-generated CRUD operations and custom resolvers.

Examples


fn custom_resolve(facade: ResolverFacade<()>) -> BoxFuture<ExecutionResult> {
    Box::pin(async move {
        let typename = "User";

        let mut props = HashMap::new();
        props.insert("role".to_string(), Value::String("Admin".to_string()));

        let n = facade.node(typename, props);

        facade.resolve_node(&n).await
    })
}

Implementations

Attempts to deserialize a Node into a struct.

Example

#[derive(Deserialize)]
struct Team {
    name: String
}

fn handle_node(n: Node<()>) {

    // succeeds if the fields of `n` can be deserialized into `Team`
    let team: Team = n.deser().unwrap();
     
}

Returns the fields of a Node.

Example
use warpgrapher::engine::objects::Node;

fn handle_node(n: Node<()>) {
    let properties = n.fields();
}

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns name of this GraphQLType to expose. Read more

Returns MetaType representing this GraphQLType.

Context type for this GraphQLValue. Read more

Type that may carry additional schema information for this GraphQLValue. Read more

Returns name of the GraphQLType exposed by this GraphQLValue. Read more

Returns the concrete GraphQLType name for this GraphQLValue being an interface, an union or an object. Read more

Resolves the value of a single field on this GraphQLValue. Read more

Resolves this GraphQLValue (being an interface or an union) into a concrete downstream object type. Read more

Resolves the provided selection_set against this GraphQLValue. Read more

Resolves the value of a single field on this GraphQLValueAsync. Read more

Resolves this GraphQLValueAsync (being an interface or an union) into a concrete downstream object type. Read more

Resolves the provided selection_set against this GraphQLValueAsync. 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

Returns the argument unchanged.

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

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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)

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more