Safe Haskell | None |
---|---|
Language | Haskell2010 |
Postgres Execute subscription
Multiplex is an optimization which allows us to group similar queries into a single query, and routing the response rows afterwards. See https://hasura.io/docs/latest/graphql/core/databases/postgres/subscriptions/execution-and-performance.html for more details
See Execute
.
Synopsis
- data QueryParametersInfo (b :: BackendType) = QueryParametersInfo {
- _qpiReusableVariableValues :: HashMap Name (ColumnValue b)
- _qpiSyntheticVariableValues :: Seq (ColumnValue b)
- _qpiReferencedSessionVariables :: HashSet SessionVariable
- qpiSyntheticVariableValues :: forall b. Lens' (QueryParametersInfo b) (Seq (ColumnValue b))
- qpiReusableVariableValues :: forall b. Lens' (QueryParametersInfo b) (HashMap Name (ColumnValue b))
- qpiReferencedSessionVariables :: forall b. Lens' (QueryParametersInfo b) (HashSet SessionVariable)
- validateVariables :: forall pgKind f m. (Traversable f, MonadError QErr m, MonadIO m) => PGExecCtx -> f (ColumnValue ('Postgres pgKind)) -> m (ValidatedVariables f)
- newtype MultiplexedQuery = MultiplexedQuery {
- unMultiplexedQuery :: Query
- toSQLFromItem :: (Backend ('Postgres pgKind), PostgresAnnotatedFieldJSON pgKind) => TableAlias -> QueryDB ('Postgres pgKind) Void SQLExp -> FromItem
- mkMultiplexedQuery :: (Backend ('Postgres pgKind), PostgresAnnotatedFieldJSON pgKind) => InsOrdHashMap Name (QueryDB ('Postgres pgKind) Void SQLExp) -> MultiplexedQuery
- mkStreamingMultiplexedQuery :: (Backend ('Postgres pgKind), PostgresAnnotatedFieldJSON pgKind) => (Name, QueryDB ('Postgres pgKind) Void SQLExp) -> MultiplexedQuery
- resolveMultiplexedValue :: (MonadState (QueryParametersInfo ('Postgres pgKind)) m, MonadError QErr m) => SessionVariables -> UnpreparedValue ('Postgres pgKind) -> m SQLExp
- executeMultiplexedQuery :: MonadTx m => MultiplexedQuery -> [(CohortId, CohortVariables)] -> m [(CohortId, ByteString)]
- executeStreamingMultiplexedQuery :: MonadTx m => MultiplexedQuery -> [(CohortId, CohortVariables)] -> m [(CohortId, ByteString, AltJ CursorVariableValues)]
- executeQuery :: (MonadTx m, FromRow a) => Query -> [(CohortId, CohortVariables)] -> m [a]
Documentation
data QueryParametersInfo (b :: BackendType) Source #
Internal: Used to collect information about various parameters of a subscription field's AST as we resolve them to SQL expressions.
QueryParametersInfo | |
|
Instances
qpiSyntheticVariableValues :: forall b. Lens' (QueryParametersInfo b) (Seq (ColumnValue b)) Source #
qpiReusableVariableValues :: forall b. Lens' (QueryParametersInfo b) (HashMap Name (ColumnValue b)) Source #
qpiReferencedSessionVariables :: forall b. Lens' (QueryParametersInfo b) (HashSet SessionVariable) Source #
validateVariables :: forall pgKind f m. (Traversable f, MonadError QErr m, MonadIO m) => PGExecCtx -> f (ColumnValue ('Postgres pgKind)) -> m (ValidatedVariables f) Source #
Checks if the provided arguments are valid values for their corresponding types.
| Generates SQL of the format "select v1
::t1, v2
::t2 ..."
newtype MultiplexedQuery Source #
MultiplexedQuery | |
|
Instances
Eq MultiplexedQuery Source # | |
Defined in Hasura.Backends.Postgres.Execute.Subscription (==) :: MultiplexedQuery -> MultiplexedQuery -> Bool # (/=) :: MultiplexedQuery -> MultiplexedQuery -> Bool # | |
Hashable MultiplexedQuery Source # | |
Defined in Hasura.Backends.Postgres.Execute.Subscription hashWithSalt :: Int -> MultiplexedQuery -> Int hash :: MultiplexedQuery -> Int | |
ToTxt MultiplexedQuery Source # | |
Defined in Hasura.Backends.Postgres.Execute.Subscription toTxt :: MultiplexedQuery -> Text Source # |
toSQLFromItem :: (Backend ('Postgres pgKind), PostgresAnnotatedFieldJSON pgKind) => TableAlias -> QueryDB ('Postgres pgKind) Void SQLExp -> FromItem Source #
mkMultiplexedQuery :: (Backend ('Postgres pgKind), PostgresAnnotatedFieldJSON pgKind) => InsOrdHashMap Name (QueryDB ('Postgres pgKind) Void SQLExp) -> MultiplexedQuery Source #
mkStreamingMultiplexedQuery :: (Backend ('Postgres pgKind), PostgresAnnotatedFieldJSON pgKind) => (Name, QueryDB ('Postgres pgKind) Void SQLExp) -> MultiplexedQuery Source #
resolveMultiplexedValue :: (MonadState (QueryParametersInfo ('Postgres pgKind)) m, MonadError QErr m) => SessionVariables -> UnpreparedValue ('Postgres pgKind) -> m SQLExp Source #
Resolves an UnresolvedVal
by converting UVPG
values to SQL
expressions that refer to the result_vars
input object, collecting information
about various parameters of the query along the way.
executeMultiplexedQuery :: MonadTx m => MultiplexedQuery -> [(CohortId, CohortVariables)] -> m [(CohortId, ByteString)] Source #
executeStreamingMultiplexedQuery :: MonadTx m => MultiplexedQuery -> [(CohortId, CohortVariables)] -> m [(CohortId, ByteString, AltJ CursorVariableValues)] Source #
executeQuery :: (MonadTx m, FromRow a) => Query -> [(CohortId, CohortVariables)] -> m [a] Source #
Internal; used by both executeMultiplexedQuery
, executeStreamingMultiplexedQuery
and pgDBSubscriptionExplain
.