graphql-engine/server/src-test/Hasura/Backends/DataConnector/RQLGenerator/GenTablePermG.hs
Daniel Chambers 4f835623b1 Rename Data Wrapper to Data Connector [GDW-89]
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4400
GitOrigin-RevId: 2d90542f95ef4dad70c8dfe1ca3b4c1f3bdaa527
2022-05-02 05:04:07 +00:00

29 lines
875 B
Haskell

module Hasura.Backends.DataConnector.RQLGenerator.GenTablePermG
( genTablePermG,
)
where
import Hasura.Backends.DataConnector.RQLGenerator.GenCommon (genAnnBoolExpFld, genTableName)
import Hasura.Generator.Common (defaultRange)
import Hasura.Prelude (pure, ($))
import Hasura.RQL.IR.Generator (genAnnBoolExp)
import Hasura.RQL.IR.Select (TablePermG (TablePerm))
import Hasura.SQL.Backend
( BackendType (DataConnector),
)
import Hedgehog (MonadGen)
import Hedgehog.Gen
( integral,
maybe,
)
--------------------------------------------------------------------------------
-- Exported
genTablePermG :: MonadGen m => m a -> m (TablePermG 'DataConnector a)
genTablePermG genA = do
let genV = genAnnBoolExpFld genA
gBoolExp <- genAnnBoolExp @_ @_ @('DataConnector) genV genTableName
limit <- maybe (integral defaultRange)
pure $ TablePerm gBoolExp limit