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

Hasura.RQL.IR.RemoteSchema

Description

Representation for queries going to remote schemas. Due to the existence of remote relationships from remote schemas, we can't simply reuse the GraphQL document AST we define in graphql-parser-hs, and instead redefine a custom structure to represent such queries.

Synopsis

Documentation

data SelectionSet r var Source #

Custom representation of a selection set.

Similarly to other parts of the IR, the r argument is used for remote relationships.

Instances

Instances details
Foldable (SelectionSet r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

fold :: Monoid m => SelectionSet r m -> m #

foldMap :: Monoid m => (a -> m) -> SelectionSet r a -> m #

foldMap' :: Monoid m => (a -> m) -> SelectionSet r a -> m #

foldr :: (a -> b -> b) -> b -> SelectionSet r a -> b #

foldr' :: (a -> b -> b) -> b -> SelectionSet r a -> b #

foldl :: (b -> a -> b) -> b -> SelectionSet r a -> b #

foldl' :: (b -> a -> b) -> b -> SelectionSet r a -> b #

foldr1 :: (a -> a -> a) -> SelectionSet r a -> a #

foldl1 :: (a -> a -> a) -> SelectionSet r a -> a #

toList :: SelectionSet r a -> [a] #

null :: SelectionSet r a -> Bool #

length :: SelectionSet r a -> Int #

elem :: Eq a => a -> SelectionSet r a -> Bool #

maximum :: Ord a => SelectionSet r a -> a #

minimum :: Ord a => SelectionSet r a -> a #

sum :: Num a => SelectionSet r a -> a #

product :: Num a => SelectionSet r a -> a #

Traversable (SelectionSet r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

traverse :: Applicative f => (a -> f b) -> SelectionSet r a -> f (SelectionSet r b) #

sequenceA :: Applicative f => SelectionSet r (f a) -> f (SelectionSet r a) #

mapM :: Monad m => (a -> m b) -> SelectionSet r a -> m (SelectionSet r b) #

sequence :: Monad m => SelectionSet r (m a) -> m (SelectionSet r a) #

Functor (SelectionSet r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

fmap :: (a -> b) -> SelectionSet r a -> SelectionSet r b #

(<$) :: a -> SelectionSet r b -> SelectionSet r a #

(Show var, Show r) => Show (SelectionSet r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

showsPrec :: Int -> SelectionSet r var -> ShowS #

show :: SelectionSet r var -> String #

showList :: [SelectionSet r var] -> ShowS #

(Eq var, Eq r) => Eq (SelectionSet r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

(==) :: SelectionSet r var -> SelectionSet r var -> Bool #

(/=) :: SelectionSet r var -> SelectionSet r var -> Bool #

data DeduplicatedSelectionSet r var Source #

Representation of the normalized selection set of an interface/union type.

This representation is used to attempt to minimize the size of the GraphQL query that eventually gets sent to the GraphQL server by defining as many fields as possible on the abstract type.

Constructors

DeduplicatedSelectionSet 

Fields

Instances

Instances details
Foldable (DeduplicatedSelectionSet r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

fold :: Monoid m => DeduplicatedSelectionSet r m -> m #

foldMap :: Monoid m => (a -> m) -> DeduplicatedSelectionSet r a -> m #

foldMap' :: Monoid m => (a -> m) -> DeduplicatedSelectionSet r a -> m #

foldr :: (a -> b -> b) -> b -> DeduplicatedSelectionSet r a -> b #

foldr' :: (a -> b -> b) -> b -> DeduplicatedSelectionSet r a -> b #

foldl :: (b -> a -> b) -> b -> DeduplicatedSelectionSet r a -> b #

foldl' :: (b -> a -> b) -> b -> DeduplicatedSelectionSet r a -> b #

foldr1 :: (a -> a -> a) -> DeduplicatedSelectionSet r a -> a #

foldl1 :: (a -> a -> a) -> DeduplicatedSelectionSet r a -> a #

toList :: DeduplicatedSelectionSet r a -> [a] #

null :: DeduplicatedSelectionSet r a -> Bool #

length :: DeduplicatedSelectionSet r a -> Int #

elem :: Eq a => a -> DeduplicatedSelectionSet r a -> Bool #

maximum :: Ord a => DeduplicatedSelectionSet r a -> a #

minimum :: Ord a => DeduplicatedSelectionSet r a -> a #

sum :: Num a => DeduplicatedSelectionSet r a -> a #

product :: Num a => DeduplicatedSelectionSet r a -> a #

Traversable (DeduplicatedSelectionSet r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Functor (DeduplicatedSelectionSet r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Generic (DeduplicatedSelectionSet r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Associated Types

type Rep (DeduplicatedSelectionSet r var) :: Type -> Type #

(Show var, Show r) => Show (DeduplicatedSelectionSet r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

(Eq var, Eq r) => Eq (DeduplicatedSelectionSet r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

type Rep (DeduplicatedSelectionSet r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

type Rep (DeduplicatedSelectionSet r var) = D1 ('MetaData "DeduplicatedSelectionSet" "Hasura.RQL.IR.RemoteSchema" "graphql-engine-1.0.0-inplace" 'False) (C1 ('MetaCons "DeduplicatedSelectionSet" 'PrefixI 'True) (S1 ('MetaSel ('Just "_dssCommonFields") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (HashSet Name)) :*: S1 ('MetaSel ('Just "_dssMemberSelectionSets") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (HashMap Name (ObjectSelectionSet r var)))))

mkInterfaceSelectionSet Source #

Arguments

:: HashSet Name

Member fields of the interface

-> [(Name, ObjectSelectionSet r var)]

Selection sets for all the member types

-> DeduplicatedSelectionSet r var 

Constructs an InterfaceSelectionSet from a set of interface fields and an association list of the fields. This function ensures that __typename is present in the set of interface fields.

mkUnionSelectionSet Source #

Arguments

:: [(Name, ObjectSelectionSet r var)]

Selection sets for all the member types

-> DeduplicatedSelectionSet r var 

Constructs an UnionSelectionSet from a list of the fields, using a singleton set of __typename for the set of common fields.

data Field r var Source #

Representation of one individual field.

This particular type is the reason why we need a different representation from the one in 'graphql-parser-hs': we differentiate between selection fields that target the actual remote schema, and fields that, instead, are remote from it and need to be treated differently.

Instances

Instances details
Foldable (Field r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

fold :: Monoid m => Field r m -> m #

foldMap :: Monoid m => (a -> m) -> Field r a -> m #

foldMap' :: Monoid m => (a -> m) -> Field r a -> m #

foldr :: (a -> b -> b) -> b -> Field r a -> b #

foldr' :: (a -> b -> b) -> b -> Field r a -> b #

foldl :: (b -> a -> b) -> b -> Field r a -> b #

foldl' :: (b -> a -> b) -> b -> Field r a -> b #

foldr1 :: (a -> a -> a) -> Field r a -> a #

foldl1 :: (a -> a -> a) -> Field r a -> a #

toList :: Field r a -> [a] #

null :: Field r a -> Bool #

length :: Field r a -> Int #

elem :: Eq a => a -> Field r a -> Bool #

maximum :: Ord a => Field r a -> a #

minimum :: Ord a => Field r a -> a #

sum :: Num a => Field r a -> a #

product :: Num a => Field r a -> a #

Traversable (Field r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

traverse :: Applicative f => (a -> f b) -> Field r a -> f (Field r b) #

sequenceA :: Applicative f => Field r (f a) -> f (Field r a) #

mapM :: Monad m => (a -> m b) -> Field r a -> m (Field r b) #

sequence :: Monad m => Field r (m a) -> m (Field r a) #

Functor (Field r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

fmap :: (a -> b) -> Field r a -> Field r b #

(<$) :: a -> Field r b -> Field r a #

(Show var, Show r) => Show (Field r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

showsPrec :: Int -> Field r var -> ShowS #

show :: Field r var -> String #

showList :: [Field r var] -> ShowS #

(Eq var, Eq r) => Eq (Field r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

(==) :: Field r var -> Field r var -> Bool #

(/=) :: Field r var -> Field r var -> Bool #

data GraphQLField r var Source #

Normalized representation of a GraphQL field.

This type is almost identical to Field, except for the fact that the selection set is our annotated SelectionSet, instead of the original SelectionSet. We use this type to represent the fields of a selection that do target the remote schema.

Instances

Instances details
Foldable (GraphQLField r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

fold :: Monoid m => GraphQLField r m -> m #

foldMap :: Monoid m => (a -> m) -> GraphQLField r a -> m #

foldMap' :: Monoid m => (a -> m) -> GraphQLField r a -> m #

foldr :: (a -> b -> b) -> b -> GraphQLField r a -> b #

foldr' :: (a -> b -> b) -> b -> GraphQLField r a -> b #

foldl :: (b -> a -> b) -> b -> GraphQLField r a -> b #

foldl' :: (b -> a -> b) -> b -> GraphQLField r a -> b #

foldr1 :: (a -> a -> a) -> GraphQLField r a -> a #

foldl1 :: (a -> a -> a) -> GraphQLField r a -> a #

toList :: GraphQLField r a -> [a] #

null :: GraphQLField r a -> Bool #

length :: GraphQLField r a -> Int #

elem :: Eq a => a -> GraphQLField r a -> Bool #

maximum :: Ord a => GraphQLField r a -> a #

minimum :: Ord a => GraphQLField r a -> a #

sum :: Num a => GraphQLField r a -> a #

product :: Num a => GraphQLField r a -> a #

Traversable (GraphQLField r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

traverse :: Applicative f => (a -> f b) -> GraphQLField r a -> f (GraphQLField r b) #

sequenceA :: Applicative f => GraphQLField r (f a) -> f (GraphQLField r a) #

mapM :: Monad m => (a -> m b) -> GraphQLField r a -> m (GraphQLField r b) #

sequence :: Monad m => GraphQLField r (m a) -> m (GraphQLField r a) #

Functor (GraphQLField r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

fmap :: (a -> b) -> GraphQLField r a -> GraphQLField r b #

(<$) :: a -> GraphQLField r b -> GraphQLField r a #

(Show var, Show r) => Show (GraphQLField r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

showsPrec :: Int -> GraphQLField r var -> ShowS #

show :: GraphQLField r var -> String #

showList :: [GraphQLField r var] -> ShowS #

(Eq var, Eq r) => Eq (GraphQLField r var) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

(==) :: GraphQLField r var -> GraphQLField r var -> Bool #

(/=) :: GraphQLField r var -> GraphQLField r var -> Bool #

data RemoteSchemaRootField r var Source #

Root entry point for a remote schema.

Instances

Instances details
Foldable (RemoteSchemaRootField r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Methods

fold :: Monoid m => RemoteSchemaRootField r m -> m #

foldMap :: Monoid m => (a -> m) -> RemoteSchemaRootField r a -> m #

foldMap' :: Monoid m => (a -> m) -> RemoteSchemaRootField r a -> m #

foldr :: (a -> b -> b) -> b -> RemoteSchemaRootField r a -> b #

foldr' :: (a -> b -> b) -> b -> RemoteSchemaRootField r a -> b #

foldl :: (b -> a -> b) -> b -> RemoteSchemaRootField r a -> b #

foldl' :: (b -> a -> b) -> b -> RemoteSchemaRootField r a -> b #

foldr1 :: (a -> a -> a) -> RemoteSchemaRootField r a -> a #

foldl1 :: (a -> a -> a) -> RemoteSchemaRootField r a -> a #

toList :: RemoteSchemaRootField r a -> [a] #

null :: RemoteSchemaRootField r a -> Bool #

length :: RemoteSchemaRootField r a -> Int #

elem :: Eq a => a -> RemoteSchemaRootField r a -> Bool #

maximum :: Ord a => RemoteSchemaRootField r a -> a #

minimum :: Ord a => RemoteSchemaRootField r a -> a #

sum :: Num a => RemoteSchemaRootField r a -> a #

product :: Num a => RemoteSchemaRootField r a -> a #

Traversable (RemoteSchemaRootField r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Functor (RemoteSchemaRootField r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

data SchemaRemoteRelationshipSelect r Source #

A remote relationship's selection and fields required for its join condition.

Constructors

SchemaRemoteRelationshipSelect 

Fields

  • _srrsLHSJoinFields :: HashMap FieldName Name

    The fields on the table that are required for the join condition of the remote relationship

  • _srrsRelationship :: r

    The field that captures the relationship r ~ (RemoteRelationshipField UnpreparedValue) when the AST is emitted by the parser. r ~ Void when an execution tree is constructed so that a backend is absolved of dealing with remote relationships.

Instances

Instances details
Foldable SchemaRemoteRelationshipSelect Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Traversable SchemaRemoteRelationshipSelect Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Functor SchemaRemoteRelationshipSelect Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Show r => Show (SchemaRemoteRelationshipSelect r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

Eq r => Eq (SchemaRemoteRelationshipSelect r) Source # 
Instance details

Defined in Hasura.RQL.IR.RemoteSchema

convertSelectionSet :: forall var. Eq var => SelectionSet Void var -> SelectionSet NoFragments var Source #

Converts a normalized selection set back into a selection set as defined in GraphQL spec, in order to send it to a remote server.

This function expects a SelectionSet for which r is Void, which guarantees that there is no longer any remote join field in the selection set.

_FieldGraphQL :: forall r var var. Prism (Field r var) (Field r var) (GraphQLField r var) (GraphQLField r var) Source #

fSelectionSet :: forall r var r. Lens (GraphQLField r var) (GraphQLField r var) (SelectionSet r var) (SelectionSet r var) Source #

fName :: forall r var. Lens' (GraphQLField r var) Name Source #

fDirectives :: forall r var. Lens' (GraphQLField r var) [Directive var] Source #

fArguments :: forall r var. Lens' (GraphQLField r var) (HashMap Name (Value var)) Source #

fAlias :: forall r var. Lens' (GraphQLField r var) Name Source #