Expand description

Relay support for async-graphql. Check out the example application to get started.

Structs

  • RelayContext allows context to be parsed to the get handler to facilitate refetching of objects. This is designed for parsing the Database connection but could be used for any global state.
  • RelayNodeID is a wrapper around a UUID with the use of the ‘RelayNodeStruct’ trait to ensure each object has a globally unique ID.

Traits

  • 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.
  • RelayNodeInterface is a trait implemented by the GraphQL interface enum to implement the fetch_node method. You should refer to the ‘RelayInterface’ macro which is the recommended way to implement this trait.
  • RelayNodeStruct is a trait implemented by the GraphQL Object to ensure each Object has a globally unique ID. You should refer to the ‘RelayNodeObject’ macro which is the recommended way to implement this trait. You MUST ensure the ID_SUFFIX is unique for each object for issue will occur.

Derive Macros

  • The RelayInterface macro is applied to a GraphQL Interface enum to allow it to be used for Relay’s node query. This enum should contain all types that that exist in your GraphQL schema to work as designed in the Relay server specification.
  • The RelayNodeObject macro is applied to a type to automatically implement the RelayNodeStruct trait.