Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class (Backend b, ToTxt (MultiplexedQuery b), Monad (ExecutionMonad b)) => BackendExecute (b :: BackendType) where
- type PreparedQuery b :: Type
- type MultiplexedQuery b :: Type
- type ExecutionMonad b :: Type -> Type
- mkDBQueryPlan :: forall m. (MonadError QErr m, MonadQueryTags m, MonadReader QueryTagsComment m) => UserInfo -> Environment -> SourceName -> SourceConfig b -> QueryDB b Void (UnpreparedValue b) -> m (DBStepInfo b)
- mkDBMutationPlan :: forall m. (MonadError QErr m, MonadQueryTags m, MonadReader QueryTagsComment m) => UserInfo -> StringifyNumbers -> SourceName -> SourceConfig b -> MutationDB b Void (UnpreparedValue b) -> m (DBStepInfo b)
- mkLiveQuerySubscriptionPlan :: forall m. (MonadError QErr m, MonadIO m, MonadBaseControl IO m, MonadReader QueryTagsComment m) => UserInfo -> SourceName -> SourceConfig b -> Maybe Name -> RootFieldMap (QueryDB b Void (UnpreparedValue b)) -> m (SubscriptionQueryPlan b (MultiplexedQuery b))
- mkDBStreamingSubscriptionPlan :: forall m. (MonadError QErr m, MonadIO m, MonadBaseControl IO m, MonadReader QueryTagsComment m) => UserInfo -> SourceName -> SourceConfig b -> (RootFieldAlias, QueryDB b Void (UnpreparedValue b)) -> m (SubscriptionQueryPlan b (MultiplexedQuery b))
- mkDBQueryExplain :: forall m. MonadError QErr m => RootFieldAlias -> UserInfo -> SourceName -> SourceConfig b -> QueryDB b Void (UnpreparedValue b) -> m (AnyBackend DBStepInfo)
- mkSubscriptionExplain :: (MonadError QErr m, MonadIO m, MonadBaseControl IO m) => SubscriptionQueryPlan b (MultiplexedQuery b) -> m SubscriptionQueryPlanExplanation
- mkDBRemoteRelationshipPlan :: forall m. (MonadError QErr m, MonadQueryTags m) => UserInfo -> SourceName -> SourceConfig b -> NonEmpty Object -> HashMap FieldName (Column b, ScalarType b) -> FieldName -> (FieldName, SourceRelationshipSelection b Void UnpreparedValue) -> m (DBStepInfo b)
- convertRemoteSourceRelationship :: forall b. Backend b => HashMap (Column b) (Column b) -> SelectFromG b (UnpreparedValue b) -> Column b -> ColumnType b -> (FieldName, SourceRelationshipSelection b Void UnpreparedValue) -> QueryDB b Void (UnpreparedValue b)
- data DBStepInfo b = DBStepInfo {}
- data ExplainPlan = ExplainPlan {}
- data ExecutionStep where
- ExecStepDB :: ResponseHeaders -> AnyBackend DBStepInfo -> Maybe RemoteJoins -> ExecutionStep
- ExecStepAction :: ActionExecutionPlan -> ActionsInfo -> Maybe RemoteJoins -> ExecutionStep
- ExecStepRemote :: !RemoteSchemaInfo -> !ResultCustomizer -> !GQLReqOutgoing -> Maybe RemoteJoins -> ExecutionStep
- ExecStepRaw :: Value -> ExecutionStep
- ExecStepMulti :: [ExecutionStep] -> ExecutionStep
- type ExecutionPlan = RootFieldMap ExecutionStep
- class Monad m => MonadQueryTags m where
- createQueryTags :: QueryTagsAttributes -> Maybe QueryTagsConfig -> Tagged m QueryTagsComment
Documentation
class (Backend b, ToTxt (MultiplexedQuery b), Monad (ExecutionMonad b)) => BackendExecute (b :: BackendType) where Source #
This typeclass enacapsulates how a given backend translates a root field into an execution plan. For now, each root field maps to one execution step, but in the future, when we have a client-side dataloader, each root field might translate into a multi-step plan.
type PreparedQuery b :: Type Source #
type MultiplexedQuery b :: Type Source #
type ExecutionMonad b :: Type -> Type Source #
mkDBQueryPlan :: forall m. (MonadError QErr m, MonadQueryTags m, MonadReader QueryTagsComment m) => UserInfo -> Environment -> SourceName -> SourceConfig b -> QueryDB b Void (UnpreparedValue b) -> m (DBStepInfo b) Source #
mkDBMutationPlan :: forall m. (MonadError QErr m, MonadQueryTags m, MonadReader QueryTagsComment m) => UserInfo -> StringifyNumbers -> SourceName -> SourceConfig b -> MutationDB b Void (UnpreparedValue b) -> m (DBStepInfo b) Source #
mkLiveQuerySubscriptionPlan :: forall m. (MonadError QErr m, MonadIO m, MonadBaseControl IO m, MonadReader QueryTagsComment m) => UserInfo -> SourceName -> SourceConfig b -> Maybe Name -> RootFieldMap (QueryDB b Void (UnpreparedValue b)) -> m (SubscriptionQueryPlan b (MultiplexedQuery b)) Source #
mkDBStreamingSubscriptionPlan :: forall m. (MonadError QErr m, MonadIO m, MonadBaseControl IO m, MonadReader QueryTagsComment m) => UserInfo -> SourceName -> SourceConfig b -> (RootFieldAlias, QueryDB b Void (UnpreparedValue b)) -> m (SubscriptionQueryPlan b (MultiplexedQuery b)) Source #
mkDBQueryExplain :: forall m. MonadError QErr m => RootFieldAlias -> UserInfo -> SourceName -> SourceConfig b -> QueryDB b Void (UnpreparedValue b) -> m (AnyBackend DBStepInfo) Source #
mkSubscriptionExplain :: (MonadError QErr m, MonadIO m, MonadBaseControl IO m) => SubscriptionQueryPlan b (MultiplexedQuery b) -> m SubscriptionQueryPlanExplanation Source #
mkDBRemoteRelationshipPlan Source #
:: forall m. (MonadError QErr m, MonadQueryTags m) | |
=> UserInfo | |
-> SourceName | |
-> SourceConfig b | |
-> NonEmpty Object | List of json objects, each of which becomes a row of the table. |
-> HashMap FieldName (Column b, ScalarType b) | The above objects have this schema. |
-> FieldName | This is a field name from the lhs that *has* to be selected in the
response along with the relationship. It is populated in
|
-> (FieldName, SourceRelationshipSelection b Void UnpreparedValue) | |
-> m (DBStepInfo b) |
Instances
convertRemoteSourceRelationship Source #
:: forall b. Backend b | |
=> HashMap (Column b) (Column b) | Join columns for the relationship |
-> SelectFromG b (UnpreparedValue b) | The LHS of the join, this is the expression which selects from json objects |
-> Column b | This is the argument id column, that needs to be added to the response This is used by by the remote joins processing logic to convert the response from upstream to join indices |
-> ColumnType b | This is the type of the argument id column |
-> (FieldName, SourceRelationshipSelection b Void UnpreparedValue) | The relationship column and its name (how it should be selected in the response) |
-> QueryDB b Void (UnpreparedValue b) |
This is a helper function to convert a remote source's relationship to a normal relationship to a temporary table. This function can be used to implement executeRemoteRelationship function in databases which support constructing a temporary table for a list of json objects.
data DBStepInfo b Source #
data ExplainPlan Source #
The result of an explain query: for a given root field (denoted by its name): the generated SQL query, and the detailed explanation obtained from the database (if any). We mostly use this type as an intermediary step, and immediately tranform any value we obtain into an equivalent JSON representation.
Instances
data ExecutionStep where Source #
One execution step to processing a GraphQL query (e.g. one root field).
ExecStepDB :: ResponseHeaders -> AnyBackend DBStepInfo -> Maybe RemoteJoins -> ExecutionStep | A query to execute against the database |
ExecStepAction :: ActionExecutionPlan -> ActionsInfo -> Maybe RemoteJoins -> ExecutionStep | Execute an action |
ExecStepRemote :: !RemoteSchemaInfo -> !ResultCustomizer -> !GQLReqOutgoing -> Maybe RemoteJoins -> ExecutionStep | A graphql query to execute against a remote schema |
ExecStepRaw :: Value -> ExecutionStep | Output a plain JSON object |
ExecStepMulti :: [ExecutionStep] -> ExecutionStep |
type ExecutionPlan = RootFieldMap ExecutionStep Source #
The series of steps that need to be executed for a given query. For now, those steps are all independent. In the future, when we implement a client-side dataloader and generalized joins, this will need to be changed into an annotated tree.
class Monad m => MonadQueryTags m where Source #
createQueryTags :: QueryTagsAttributes -> Maybe QueryTagsConfig -> Tagged m QueryTagsComment Source #
Creates Query Tags. These are appended to the Generated SQL. Helps users to use native database monitoring tools to get some 'application-context'.