Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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
- nodeInterface :: SourceCache -> NodeInterfaceParserBuilder
- nodeField :: forall m n. (MonadError QErr m, MonadMemoize m, MonadParse n) => SourceCache -> SchemaContext -> SchemaOptions -> m (FieldParser n (QueryRootField UnpreparedValue))
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. (MonadError QErr m, MonadMemoize m, MonadParse n) => SourceCache -> SchemaContext -> SchemaOptions -> 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.