graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.GraphQL.Execute.RemoteJoin.Source

Description

How to construct and execute a call to a source for a remote join.

There are three steps required to do this: - construct the execution step for that source join - execute that GraphQL query over the network - build a join index of the variables out of the response

This can be done as one function, but we also export the individual steps for debugging / test purposes. We congregate all intermediary state in the opaque SourceJoinCall type.

Synopsis

Documentation

makeSourceJoinCall Source #

Arguments

:: (MonadQueryTags m, MonadError QErr m, MonadTrace m, MonadIO m) 
=> (AnyBackend SourceJoinCall -> m ByteString)

Function to dispatch a request to a source.

-> UserInfo

User information.

-> AnyBackend RemoteSourceJoin

Remote join information.

-> FieldName

Name of the field from the join arguments.

-> IntMap JoinArgument

Mapping from JoinArgumentId to its corresponding JoinArgument.

-> [Header] 
-> Maybe Name 
-> m (Maybe (IntMap Value))

The resulting join index (see buildJoinIndex) if any.

Construct and execute a call to a source for a remote join.

data SourceJoinCall b Source #

Intermediate type that contains all the necessary information to perform a call to a database to perform a join.

buildJoinIndex :: MonadError QErr m => ByteString -> m (IntMap Value) Source #

Construct a join index from the EncJSON response from the source.

Unlike with remote schemas, we can make assumptions about the shape of the result, instead of having to keep track of the path within the answer. This function therefore enforces that the answer has the shape we expect, and throws a QErr if it doesn't.