mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-20 14:01:39 +03:00
acde210fdc
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4460 GitOrigin-RevId: 7b772cd9fba6b612ad05eb1aca1fa13e6ae8556d
31 lines
1.1 KiB
Haskell
31 lines
1.1 KiB
Haskell
module Hasura.Backends.Postgres.RQLGenerator.GenTablePermG
|
|
( genTablePermG,
|
|
)
|
|
where
|
|
|
|
import Hasura.Backends.Postgres.RQLGenerator.GenAssociatedTypes
|
|
( genBooleanOperators,
|
|
genColumn,
|
|
genFunctionArgumentExp,
|
|
genFunctionName,
|
|
genScalarType,
|
|
genTableName,
|
|
genXComputedField,
|
|
)
|
|
import Hasura.Generator.Common (defaultRange)
|
|
import Hasura.Prelude
|
|
import Hasura.RQL.IR.Generator (genAnnBoolExp, genAnnBoolExpFld)
|
|
import Hasura.RQL.IR.Select (TablePermG (..))
|
|
import Hasura.SQL.Backend (BackendType (..), PostgresKind (..))
|
|
import Hedgehog (MonadGen)
|
|
import Hedgehog.Gen qualified as Gen
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
genTablePermG :: MonadGen m => m a -> m (TablePermG ('Postgres 'Vanilla) a)
|
|
genTablePermG genA = do
|
|
let genV = genAnnBoolExpFld @_ @('Postgres 'Vanilla) genColumn genTableName genScalarType genFunctionName genXComputedField (genBooleanOperators genA) (genFunctionArgumentExp genA) genA
|
|
gBoolExp <- genAnnBoolExp @_ @_ @('Postgres 'Vanilla) genV genTableName
|
|
limit <- Gen.maybe (Gen.integral defaultRange)
|
|
pure $ TablePerm gBoolExp limit
|