graphql-engine/server/src-test/Hasura/Backends/DataConnector/RQLGenerator/GenAnnSelectG.hs
paritosh-08 d66abcefab server: transform enum with upper for graphql-default
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5032
GitOrigin-RevId: 206a673f4bd59700436f6160feeb7df415f637ad
2022-07-19 06:56:45 +00:00

35 lines
1.2 KiB
Haskell

module Hasura.Backends.DataConnector.RQLGenerator.GenAnnSelectG
( genAnnSelectG,
)
where
import Hasura.Backends.DataConnector.RQLGenerator.GenSelectArgsG (genSelectArgsG)
import Hasura.Backends.DataConnector.RQLGenerator.GenSelectFromG (genSelectFromG)
import Hasura.Backends.DataConnector.RQLGenerator.GenTablePermG (genTablePermG)
import Hasura.Generator.Common (defaultRange)
import Hasura.GraphQL.Schema.Options qualified as Options
import Hasura.Prelude hiding (bool)
import Hasura.RQL.IR (AnnSelectG (..))
import Hasura.RQL.IR.Generator (genFields)
import Hasura.SQL.Backend (BackendType (..))
import Hedgehog (MonadGen)
import Hedgehog.Gen (bool)
--------------------------------------------------------------------------------
genAnnSelectG :: forall m f a. MonadGen m => m a -> m (f a) -> m (AnnSelectG 'DataConnector f a)
genAnnSelectG genA genFA =
AnnSelectG
<$> genFields genFA defaultRange defaultRange
<*> genSelectFromG
<*> genTablePermG genA
<*> genArgs
<*> genStringifyNumbers
<*> (pure Nothing)
where
genStringifyNumbers =
bool <&> \case
False -> Options.Don'tStringifyNumbers
True -> Options.StringifyNumbers
genArgs = genSelectArgsG genA