Safe Haskell | Safe-Inferred |
---|---|
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 {}
- validateVariablesTx :: forall pgKind f m. (Traversable f, MonadTx m, MonadIO m) => f (ColumnValue ('Postgres pgKind)) -> m (ValidatedVariables f)
- newtype MultiplexedQuery = MultiplexedQuery {}
- 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, ViaJSON CursorVariableValues)]
- executeQuery :: (MonadTx m, FromRes 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
validateVariablesTx :: forall pgKind f m. (Traversable f, MonadTx m, MonadIO m) => 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 #
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 Source # hash :: MultiplexedQuery -> Int Source # | |
ToTxt MultiplexedQuery Source # | |
Defined in Hasura.Backends.Postgres.Execute.Subscription toTxt :: MultiplexedQuery -> Text 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, ViaJSON CursorVariableValues)] Source #
executeQuery :: (MonadTx m, FromRes a) => Query -> [(CohortId, CohortVariables)] -> m a Source #
Internal; used by both executeMultiplexedQuery
, executeStreamingMultiplexedQuery
and pgDBSubscriptionExplain
.