pub trait RelayNode: RelayNodeStruct {
type TNode: RelayNodeInterface;
// Required method
fn get<'async_trait>(
ctx: RelayContext,
id: RelayNodeID<Self>,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::TNode>, Error>> + Send + 'async_trait>>
where Self: 'async_trait;
}
Expand description
RelayNode is a trait implemented on the GraphQL Object to define how it should be fetched. This is used by the ‘node’ query so that the object can be refetched.
Required Associated Types§
Sourcetype TNode: RelayNodeInterface
type TNode: RelayNodeInterface
TNode is the type of the Node interface. This should point the enum with the ‘RelayInterface’ macro.
Required Methods§
Sourcefn get<'async_trait>(
ctx: RelayContext,
id: RelayNodeID<Self>,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::TNode>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
fn get<'async_trait>(
ctx: RelayContext,
id: RelayNodeID<Self>,
) -> Pin<Box<dyn Future<Output = Result<Option<Self::TNode>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
get is a method defines by the user to refetch an object of a particular type. The context can be used to share a database connection or other required context to facilitate the refetch.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.