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

Hasura.GraphQL.Execute.RemoteJoin.Join

Synopsis

Documentation

processRemoteJoins :: forall m. (MonadError QErr m, MonadIO m, MonadQueryTags m, MonadQueryLog m, MonadTrace m) => RequestId -> Logger Hasura -> Environment -> Manager -> [Header] -> UserInfo -> EncJSON -> Maybe RemoteJoins -> GQLReqUnparsed -> m EncJSON Source #

Process all remote joins, recursively.

Given the result of the first step of an execution and its associated remote joins, process all joins recursively to build the resulting JSON object.

This function is a thin wrapper around processRemoteJoinsWith, and starts the join tree traversal process by re-parsing the EncJSON value into an introspectable JSON Value, and "injects" the required functions to process each join over the network.

foldJoinTreeWith Source #

Arguments

:: (MonadError QErr m, MonadQueryTags m, Traversable f) 
=> (AnyBackend SourceJoinCall -> m ByteString)

How to process a call to a source.

-> (ValidatedRemoteSchemaDef -> GQLReqOutgoing -> m ByteString)

How to process a call to a remote schema.

-> UserInfo

User information.

-> f Value

Initial accumulator; the LHS of this join tree.

-> RemoteJoins 
-> m (f Value) 

Fold the join tree.

This function takes as an argument the functions that will be used to do the actual network calls; this allows this function not to require MonadIO, allowing it to be used in tests.

forRemoteJoins :: Applicative f => Maybe RemoteJoins -> a -> (RemoteJoins -> f a) -> f a Source #

Simple convenient wrapper around Maybe RemoteJoins.

assignJoinIds :: JoinTree RemoteJoin -> JoinTree (JoinCallId, RemoteJoin) Source #

When traversing a responses's json, wherever the join columns of a remote join are expected, we want to collect these arguments.

However looking up by a remote join's definition to collect these arguments does not work because we don't have an Ord or a Hashable instance (it would be a bit of work).

So this assigned each remote join a unique integer ID by using just the Eq instance. This ID then can be used for the collection of arguments (which should also be faster).

TODO(nicuveo): https://github.com/hasura/graphql-engine-mono/issues/3891.

type CompositeObject a = InsOrdHashMap Text (CompositeValue a) Source #

data CompositeValue a Source #

A hybrid JSON value representation which captures the context of remote join field in type parameter.

data ReplacementToken Source #

A token used to uniquely identify the results within a join call that are associated with a particular argument.

Constructors

ReplacementToken 

Fields