graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.GraphQL.Schema.Relay

Description

This module only exposes one function, nodeField, which is used at the root level of the schema to create the node field in the Relay API schema.

Synopsis

Documentation

nodeInterface :: SourceCache -> NodeInterfaceParserBuilder Source #

Constructs the parser for the node interface.

As mentioned in Note [Internal Relay HashMap], this function must parse an incoming query for ANY potential matching table. Its resulting parser returns a NodeMap: a container that, to a source name and a table name, associates both the parsed fields and all the relevant table information required to craft a request.

nodeField :: forall m n r. SourceCache -> MonadBuildSchemaBase r m n => m (FieldParser n (QueryRootField UnpreparedValue)) Source #

Creates a field parser for the top-level "node" field in the QueryRoot.

It exepcts one argument, the node id. It looks for the targeted table in the NodeMap returned by nodeInterface, and, if successful, attempts to craft a corresponding QueryRootField that will extract the requested row.