Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module contains Data Connector request/response planning code and utility functions and types that are common across the different categories of requests (ie queries, mutations, etc). It contains code and concepts that are independent of these different categories.
Both QueryPlan
and
MutationPlan
use the contents of this module,
for example mkQueryPlan
.
Synopsis
- data Plan request response = Plan {
- _pRequest :: request
- _pResponseReshaper :: forall m. MonadError QErr m => response -> m Encoding
- data TableRelationshipsKey
- newtype TableRelationships = TableRelationships {}
- recordTableRelationship :: (Has TableRelationships writerOutput, Monoid writerOutput, MonadError QErr m) => TableRelationshipsKey -> RelationshipName -> Relationship -> WriterT writerOutput m ()
- recordTableRelationshipFromRelInfo :: (Has TableRelationships writerOutput, Monoid writerOutput, MonadError QErr m) => TableRelationshipsKey -> RelInfo 'DataConnector -> WriterT writerOutput m (RelationshipName, Relationship)
- data FieldPrefix
- noPrefix :: FieldPrefix
- prefixWith :: FieldName -> FieldPrefix
- applyPrefix :: FieldPrefix -> FieldName -> FieldName
- data Cardinality
- prepareLiteral :: (MonadError QErr m, MonadReader r m, Has ScalarTypesCapabilities r) => SessionVariables -> UnpreparedValue 'DataConnector -> m Literal
- translateBoolExpToExpression :: (Has TableRelationships writerOutput, Monoid writerOutput, MonadError QErr m, MonadReader r m, Has ScalarTypesCapabilities r) => SessionVariables -> TableRelationshipsKey -> AnnBoolExp 'DataConnector (UnpreparedValue 'DataConnector) -> WriterT writerOutput m (Maybe Expression)
- mkRelationshipName :: RelName -> RelationshipName
- mapFieldNameHashMap :: HashMap FieldName v -> HashMap FieldName v
- encodeAssocListAsObject :: [(Text, Encoding)] -> Encoding
Documentation
data Plan request response Source #
Represents a request
to be sent to a data connector agent (_pRequest
) and a function
that is capable of reshaping the response to that request into the final JSON form expected
to be returned by the GraphQL endpoint (_pResponseReshaper
).
Plan | |
|
data TableRelationshipsKey Source #
Key datatype for TableRelationships to avoid having an Either directly as the key, and make extending the types of relationships easier in future.
Instances
newtype TableRelationships Source #
A monoidal data structure used to record Table Relationships encountered during request
translation. Used with recordTableRelationship
.
Instances
Monoid TableRelationships Source # | |
Semigroup TableRelationships Source # | |
Defined in Hasura.Backends.DataConnector.Plan.Common (<>) :: TableRelationships -> TableRelationships -> TableRelationships # sconcat :: NonEmpty TableRelationships -> TableRelationships # stimes :: Integral b => b -> TableRelationships -> TableRelationships # | |
Show TableRelationships Source # | |
Defined in Hasura.Backends.DataConnector.Plan.Common showsPrec :: Int -> TableRelationships -> ShowS # show :: TableRelationships -> String # showList :: [TableRelationships] -> ShowS # | |
Eq TableRelationships Source # | |
Defined in Hasura.Backends.DataConnector.Plan.Common (==) :: TableRelationships -> TableRelationships -> Bool # (/=) :: TableRelationships -> TableRelationships -> Bool # |
recordTableRelationship :: (Has TableRelationships writerOutput, Monoid writerOutput, MonadError QErr m) => TableRelationshipsKey -> RelationshipName -> Relationship -> WriterT writerOutput m () Source #
Records a table relationship encountered during request translation into the output of the current
WriterT
recordTableRelationshipFromRelInfo :: (Has TableRelationships writerOutput, Monoid writerOutput, MonadError QErr m) => TableRelationshipsKey -> RelInfo 'DataConnector -> WriterT writerOutput m (RelationshipName, Relationship) Source #
data FieldPrefix Source #
Represents a potential prefix that can be applied to a field name, useful for namespacing field names that may be otherwise duplicated.
Instances
Monoid FieldPrefix Source # | |
Defined in Hasura.Backends.DataConnector.Plan.Common mempty :: FieldPrefix # mappend :: FieldPrefix -> FieldPrefix -> FieldPrefix # mconcat :: [FieldPrefix] -> FieldPrefix # | |
Semigroup FieldPrefix Source # | |
Defined in Hasura.Backends.DataConnector.Plan.Common (<>) :: FieldPrefix -> FieldPrefix -> FieldPrefix # sconcat :: NonEmpty FieldPrefix -> FieldPrefix # stimes :: Integral b => b -> FieldPrefix -> FieldPrefix # | |
Show FieldPrefix Source # | |
Defined in Hasura.Backends.DataConnector.Plan.Common showsPrec :: Int -> FieldPrefix -> ShowS # show :: FieldPrefix -> String # showList :: [FieldPrefix] -> ShowS # | |
Eq FieldPrefix Source # | |
Defined in Hasura.Backends.DataConnector.Plan.Common (==) :: FieldPrefix -> FieldPrefix -> Bool # (/=) :: FieldPrefix -> FieldPrefix -> Bool # |
prefixWith :: FieldName -> FieldPrefix Source #
applyPrefix :: FieldPrefix -> FieldName -> FieldName Source #
data Cardinality Source #
prepareLiteral :: (MonadError QErr m, MonadReader r m, Has ScalarTypesCapabilities r) => SessionVariables -> UnpreparedValue 'DataConnector -> m Literal Source #
translateBoolExpToExpression :: (Has TableRelationships writerOutput, Monoid writerOutput, MonadError QErr m, MonadReader r m, Has ScalarTypesCapabilities r) => SessionVariables -> TableRelationshipsKey -> AnnBoolExp 'DataConnector (UnpreparedValue 'DataConnector) -> WriterT writerOutput m (Maybe Expression) Source #