mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
Remove resolveUnpreparedValue
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4743 GitOrigin-RevId: 1d532ac2475e292e587581ac840d056e3b96a951
This commit is contained in:
parent
2526dd0114
commit
16213a9b77
@ -14,7 +14,6 @@ module Hasura.Backends.Postgres.Execute.Prepare
|
||||
initPlanningSt,
|
||||
prepareWithPlan,
|
||||
prepareWithoutPlan,
|
||||
resolveUnpreparedValue,
|
||||
withUserVars,
|
||||
)
|
||||
where
|
||||
@ -104,24 +103,6 @@ prepareWithoutPlan userInfo = \case
|
||||
"missing session variable: " <>> sessionVariableToText sessVar
|
||||
pure $ withTypeAnn ty sessionVariableValue
|
||||
|
||||
resolveUnpreparedValue ::
|
||||
(MonadError QErr m) =>
|
||||
UserInfo ->
|
||||
UnpreparedValue ('Postgres pgKind) ->
|
||||
m S.SQLExp
|
||||
resolveUnpreparedValue userInfo = \case
|
||||
UVParameter _ cv -> pure $ toTxtValue cv
|
||||
UVLiteral sqlExp -> pure sqlExp
|
||||
UVSession -> pure $ sessionInfoJsonExp $ _uiSession userInfo
|
||||
UVSessionVar ty sessionVariable -> do
|
||||
let maybeSessionVariableValue =
|
||||
getSessionVariableValue sessionVariable (_uiSession userInfo)
|
||||
sessionVariableValue <-
|
||||
fmap S.SELit
|
||||
<$> onNothing maybeSessionVariableValue
|
||||
$ throw400 UnexpectedPayload $ "missing required session variable for role " <> _uiRole userInfo <<> " : " <> sessionVariableToText sessionVariable
|
||||
pure $ withTypeAnn ty sessionVariableValue
|
||||
|
||||
withUserVars :: SessionVariables -> PrepArgMap -> PrepArgMap
|
||||
withUserVars usrVars list =
|
||||
let usrVarsAsPgScalar = PGValJSON $ Q.JSON $ J.toJSON usrVars
|
||||
|
@ -29,7 +29,6 @@ import Hasura.Backends.Postgres.Execute.Prepare
|
||||
initPlanningSt,
|
||||
prepareWithPlan,
|
||||
prepareWithoutPlan,
|
||||
resolveUnpreparedValue,
|
||||
withUserVars,
|
||||
)
|
||||
import Hasura.Backends.Postgres.Execute.Subscription qualified as PGL
|
||||
@ -149,7 +148,7 @@ pgDBQueryExplain ::
|
||||
QueryDB ('Postgres pgKind) Void (UnpreparedValue ('Postgres pgKind)) ->
|
||||
m (AB.AnyBackend DBStepInfo)
|
||||
pgDBQueryExplain fieldName userInfo sourceName sourceConfig rootSelection = do
|
||||
preparedQuery <- traverse (resolveUnpreparedValue userInfo) rootSelection
|
||||
preparedQuery <- traverse (prepareWithoutPlan userInfo) rootSelection
|
||||
let PreparedSql querySQL _ = irToRootFieldPlan mempty preparedQuery
|
||||
textSQL = Q.getQueryText querySQL
|
||||
-- CAREFUL!: an `EXPLAIN ANALYZE` here would actually *execute* this
|
||||
|
Loading…
Reference in New Issue
Block a user