2021-11-10 14:12:01 +03:00
|
|
|
-- | This module provides generators for the IR query selection type.
|
|
|
|
--
|
|
|
|
-- The generators in this module generally take the low-level Backend-specific
|
|
|
|
-- generators as inputs and distribute them along the generators for its parts.
|
|
|
|
-- This is different from lifting the constructor because we distribute these
|
|
|
|
-- low-level generators through.
|
|
|
|
module Hasura.RQL.IR.Generator
|
2022-04-08 09:48:37 +03:00
|
|
|
( genAnnBoolExp,
|
2022-04-06 01:08:43 +03:00
|
|
|
genAnnBoolExpFld,
|
|
|
|
genAnnotatedOrderByItemG,
|
|
|
|
genAnnotatedOrderByElement,
|
2022-04-08 09:48:37 +03:00
|
|
|
genAnnotatedAggregateOrderBy,
|
2022-04-06 01:08:43 +03:00
|
|
|
genArgumentExp,
|
2022-04-08 09:48:37 +03:00
|
|
|
genColumnInfo,
|
|
|
|
genFields,
|
|
|
|
genFunctionArgsExpG,
|
2022-04-06 01:08:43 +03:00
|
|
|
genIdentifier,
|
2022-04-08 09:48:37 +03:00
|
|
|
genInsertOrder,
|
|
|
|
genRelName,
|
|
|
|
genRelType,
|
2021-11-10 14:12:01 +03:00
|
|
|
)
|
|
|
|
where
|
|
|
|
|
|
|
|
import Hasura.Generator.Common
|
|
|
|
import Hasura.Prelude hiding (bool, choice, maybe, nonEmpty)
|
2022-04-06 01:08:43 +03:00
|
|
|
import Hasura.RQL.IR (OrderByItemG (OrderByItemG))
|
2021-11-10 14:12:01 +03:00
|
|
|
import Hasura.RQL.IR.Select
|
|
|
|
import Hasura.RQL.Types
|
|
|
|
import Hedgehog
|
|
|
|
import Hedgehog.Gen
|
|
|
|
|
|
|
|
-- | Generate a list of pairs of field names and 'a's.
|
|
|
|
--
|
|
|
|
-- | See 'genFieldName' for details on generating field names.
|
|
|
|
genFields :: MonadGen m => m a -> Range Int -> Range Int -> m (Fields a)
|
|
|
|
genFields genA fieldsRange fieldNameRange =
|
|
|
|
list fieldsRange $ (,) <$> genFieldName fieldNameRange <*> genA
|
|
|
|
|
|
|
|
genFunctionArgsExpG ::
|
|
|
|
MonadGen m =>
|
|
|
|
m a ->
|
|
|
|
m (FunctionArgsExpG a)
|
2022-04-06 01:08:43 +03:00
|
|
|
genFunctionArgsExpG genA =
|
2021-11-10 14:12:01 +03:00
|
|
|
FunctionArgsExp
|
2022-04-08 09:48:37 +03:00
|
|
|
<$> list defaultRange genA
|
|
|
|
<*> genHashMap (genArbitraryUnicodeText defaultRange) genA defaultRange
|
2021-11-10 14:12:01 +03:00
|
|
|
|
2021-12-13 19:48:10 +03:00
|
|
|
genArgumentExp :: MonadGen m => m a -> m (ArgumentExp a)
|
|
|
|
genArgumentExp genA = choice [tableRow, session, input]
|
2021-11-10 14:12:01 +03:00
|
|
|
where
|
2021-12-13 19:48:10 +03:00
|
|
|
-- Don't actually generate this except manually, as it presumes
|
|
|
|
-- that the root table has a specific column.
|
|
|
|
--
|
|
|
|
-- responsePayload = pure AEActionResponsePayload
|
|
|
|
tableRow = pure AETableRow
|
2021-11-10 14:12:01 +03:00
|
|
|
session = AESession <$> genA
|
|
|
|
input = AEInput <$> genA
|
|
|
|
|
|
|
|
genGExists ::
|
|
|
|
MonadGen m =>
|
|
|
|
m a ->
|
|
|
|
m (TableName b) ->
|
|
|
|
m (GExists b a)
|
2022-04-06 01:08:43 +03:00
|
|
|
genGExists aGen tableGen =
|
|
|
|
GExists <$> tableGen <*> genAnnBoolExp aGen tableGen
|
2021-11-10 14:12:01 +03:00
|
|
|
|
|
|
|
genAnnBoolExp ::
|
|
|
|
MonadGen m =>
|
|
|
|
m a ->
|
|
|
|
m (TableName b) ->
|
|
|
|
m (GBoolExp b a)
|
|
|
|
genAnnBoolExp
|
|
|
|
aGen
|
2022-04-06 01:08:43 +03:00
|
|
|
tableGen =
|
2021-11-10 14:12:01 +03:00
|
|
|
recursive
|
|
|
|
choice
|
|
|
|
[boolFld]
|
|
|
|
[boolAnd, boolOr, boolNot, boolExists]
|
|
|
|
where
|
2022-04-08 09:48:37 +03:00
|
|
|
boolAnd = BoolAnd <$> list defaultRange (genAnnBoolExp aGen tableGen)
|
|
|
|
boolOr = BoolOr <$> list defaultRange (genAnnBoolExp aGen tableGen)
|
2022-04-06 01:08:43 +03:00
|
|
|
boolNot = BoolNot <$> genAnnBoolExp aGen tableGen
|
|
|
|
boolExists = BoolExists <$> genGExists aGen tableGen
|
2021-11-10 14:12:01 +03:00
|
|
|
boolFld = BoolFld <$> aGen
|
|
|
|
|
|
|
|
genAnnBoolExpFld ::
|
|
|
|
MonadGen m =>
|
|
|
|
Eq (ScalarType b) =>
|
|
|
|
Eq (Column b) =>
|
|
|
|
Hashable (ScalarType b) =>
|
|
|
|
Hashable (Column b) =>
|
|
|
|
m (Column b) ->
|
|
|
|
m (TableName b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (FunctionName b) ->
|
|
|
|
m (XComputedField b) ->
|
|
|
|
m (BooleanOperators b a) ->
|
|
|
|
m a ->
|
|
|
|
m (AnnBoolExpFld b a)
|
|
|
|
genAnnBoolExpFld
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
2022-04-06 01:08:43 +03:00
|
|
|
genA =
|
2021-11-10 14:12:01 +03:00
|
|
|
choice [column, relationship, computedField]
|
|
|
|
where
|
|
|
|
column =
|
|
|
|
AVColumn
|
|
|
|
<$> genColumnInfo
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
<*> list
|
2022-04-08 09:48:37 +03:00
|
|
|
defaultRange
|
2021-11-10 14:12:01 +03:00
|
|
|
( genOpExpG
|
|
|
|
genTableName
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
)
|
|
|
|
relationship =
|
|
|
|
AVRelationship
|
2022-04-06 01:08:43 +03:00
|
|
|
<$> genRelInfo genTableName genColumn
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> genAnnBoolExp
|
|
|
|
( genAnnBoolExpFld
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
)
|
|
|
|
genTableName
|
|
|
|
computedField =
|
|
|
|
AVComputedField
|
|
|
|
<$> genAnnComputedFieldBolExp
|
|
|
|
genTableName
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genBooleanOperators
|
|
|
|
genXComputedField
|
|
|
|
genFunctionName
|
|
|
|
genA
|
|
|
|
|
|
|
|
genRelInfo ::
|
|
|
|
MonadGen m =>
|
|
|
|
Eq (Column b) =>
|
|
|
|
Hashable (Column b) =>
|
|
|
|
m (TableName b) ->
|
|
|
|
m (Column b) ->
|
|
|
|
m (RelInfo b)
|
2022-04-06 01:08:43 +03:00
|
|
|
genRelInfo genTableName genColumn =
|
2021-11-10 14:12:01 +03:00
|
|
|
RelInfo
|
2022-04-06 01:08:43 +03:00
|
|
|
<$> genRelName
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> genRelType
|
2022-04-08 09:48:37 +03:00
|
|
|
<*> genHashMap genColumn genColumn defaultRange
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> genTableName
|
|
|
|
<*> bool_
|
|
|
|
<*> genInsertOrder
|
|
|
|
|
2022-04-06 01:08:43 +03:00
|
|
|
genRelName :: MonadGen m => m RelName
|
2022-04-08 09:48:37 +03:00
|
|
|
genRelName = RelName <$> genNonEmptyText defaultRange
|
2021-11-10 14:12:01 +03:00
|
|
|
|
|
|
|
genRelType :: MonadGen m => m RelType
|
|
|
|
genRelType = element [ObjRel, ArrRel]
|
|
|
|
|
|
|
|
genInsertOrder :: MonadGen m => m InsertOrder
|
|
|
|
genInsertOrder = element [BeforeParent, AfterParent]
|
|
|
|
|
|
|
|
genAnnComputedFieldBolExp ::
|
|
|
|
MonadGen m =>
|
|
|
|
Eq (ScalarType b) =>
|
|
|
|
Eq (Column b) =>
|
|
|
|
Hashable (ScalarType b) =>
|
|
|
|
Hashable (Column b) =>
|
|
|
|
m (TableName b) ->
|
|
|
|
m (Column b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (BooleanOperators b a) ->
|
|
|
|
m (XComputedField b) ->
|
|
|
|
m (FunctionName b) ->
|
|
|
|
m a ->
|
|
|
|
m (AnnComputedFieldBoolExp b a)
|
|
|
|
genAnnComputedFieldBolExp
|
|
|
|
genTableName
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genBooleanOperators
|
|
|
|
genXComputedField
|
|
|
|
genFunctionName
|
2022-04-06 01:08:43 +03:00
|
|
|
genA =
|
2021-11-10 14:12:01 +03:00
|
|
|
AnnComputedFieldBoolExp
|
|
|
|
<$> genXComputedField
|
2022-04-06 01:08:43 +03:00
|
|
|
<*> genComputedFieldName
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> genFunctionName
|
|
|
|
<*> genSessionArgumentPresence genA
|
|
|
|
<*> genComputedFieldBoolExp
|
|
|
|
genTableName
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
|
|
|
|
genComputedFieldBoolExp ::
|
|
|
|
MonadGen m =>
|
|
|
|
Eq (ScalarType b) =>
|
|
|
|
Eq (Column b) =>
|
|
|
|
Hashable (ScalarType b) =>
|
|
|
|
Hashable (Column b) =>
|
|
|
|
m (TableName b) ->
|
|
|
|
m (Column b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (FunctionName b) ->
|
|
|
|
m (XComputedField b) ->
|
|
|
|
m (BooleanOperators b a) ->
|
|
|
|
m a ->
|
|
|
|
m (ComputedFieldBoolExp b a)
|
|
|
|
genComputedFieldBoolExp
|
|
|
|
genTableName
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
2022-04-06 01:08:43 +03:00
|
|
|
genA =
|
2021-11-10 14:12:01 +03:00
|
|
|
choice
|
|
|
|
[ CFBEScalar
|
|
|
|
<$> list
|
2022-04-08 09:48:37 +03:00
|
|
|
defaultRange
|
2021-11-10 14:12:01 +03:00
|
|
|
( genOpExpG
|
|
|
|
genTableName
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
),
|
|
|
|
CFBETable
|
|
|
|
<$> genTableName
|
|
|
|
<*> genAnnBoolExp
|
|
|
|
( genAnnBoolExpFld
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
)
|
|
|
|
genTableName
|
|
|
|
]
|
|
|
|
|
2022-04-06 01:08:43 +03:00
|
|
|
genComputedFieldName :: MonadGen m => m ComputedFieldName
|
2022-04-08 09:48:37 +03:00
|
|
|
genComputedFieldName = ComputedFieldName <$> genNonEmptyText defaultRange
|
2021-11-10 14:12:01 +03:00
|
|
|
|
|
|
|
genSessionArgumentPresence :: MonadGen m => m a -> m (SessionArgumentPresence a)
|
|
|
|
genSessionArgumentPresence genA =
|
|
|
|
choice
|
|
|
|
[ pure SAPNotPresent,
|
|
|
|
SAPFirst <$> genA,
|
|
|
|
SAPSecond <$> genA
|
|
|
|
]
|
|
|
|
|
|
|
|
genOpExpG ::
|
|
|
|
MonadGen m =>
|
|
|
|
Eq (ScalarType b) =>
|
|
|
|
Hashable (ScalarType b) =>
|
|
|
|
m (TableName b) ->
|
|
|
|
m (Column b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (BooleanOperators b a) ->
|
|
|
|
m a ->
|
|
|
|
m (OpExpG b a)
|
2022-04-06 01:08:43 +03:00
|
|
|
genOpExpG genTableName genColumn genScalarType genBooleanOperators genA =
|
2021-11-10 14:12:01 +03:00
|
|
|
choice
|
|
|
|
[ acast,
|
|
|
|
aeq,
|
|
|
|
ane,
|
|
|
|
ain,
|
|
|
|
anin,
|
|
|
|
agt,
|
|
|
|
alt,
|
|
|
|
agte,
|
|
|
|
alte,
|
|
|
|
alike,
|
|
|
|
anlike,
|
|
|
|
ceq,
|
|
|
|
cne,
|
|
|
|
cgt,
|
|
|
|
clt,
|
|
|
|
cgte,
|
|
|
|
clte,
|
|
|
|
anIsNull,
|
|
|
|
anIsNotNull,
|
|
|
|
aBackendSpecific
|
|
|
|
]
|
|
|
|
where
|
|
|
|
acast =
|
|
|
|
ACast
|
|
|
|
<$> genHashMap
|
|
|
|
genScalarType
|
2022-04-08 09:48:37 +03:00
|
|
|
( list defaultRange $
|
2021-11-10 14:12:01 +03:00
|
|
|
genOpExpG
|
|
|
|
genTableName
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
)
|
2022-04-08 09:48:37 +03:00
|
|
|
defaultRange
|
2021-11-10 14:12:01 +03:00
|
|
|
aeq = AEQ <$> bool_ <*> genA
|
|
|
|
ane = ANE <$> bool_ <*> genA
|
|
|
|
ain = AIN <$> genA
|
|
|
|
anin = ANIN <$> genA
|
|
|
|
agt = AGT <$> genA
|
|
|
|
alt = ALT <$> genA
|
|
|
|
agte = AGTE <$> genA
|
|
|
|
alte = ALTE <$> genA
|
|
|
|
alike = ALIKE <$> genA
|
|
|
|
anlike = ANLIKE <$> genA
|
|
|
|
ceq = fmap CEQ $ RootOrCurrentColumn <$> genRootOrCurrent <*> genColumn
|
|
|
|
cne = fmap CNE $ RootOrCurrentColumn <$> genRootOrCurrent <*> genColumn
|
|
|
|
cgt = fmap CGT $ RootOrCurrentColumn <$> genRootOrCurrent <*> genColumn
|
|
|
|
clt = fmap CLT $ RootOrCurrentColumn <$> genRootOrCurrent <*> genColumn
|
|
|
|
cgte = fmap CGTE $ RootOrCurrentColumn <$> genRootOrCurrent <*> genColumn
|
|
|
|
clte = fmap CLTE $ RootOrCurrentColumn <$> genRootOrCurrent <*> genColumn
|
|
|
|
anIsNull = pure ANISNULL
|
|
|
|
anIsNotNull = pure ANISNOTNULL
|
|
|
|
aBackendSpecific = ABackendSpecific <$> genBooleanOperators
|
|
|
|
|
|
|
|
genRootOrCurrent = element [IsRoot, IsCurrent]
|
|
|
|
|
|
|
|
genColumnType ::
|
|
|
|
MonadGen m =>
|
|
|
|
m (TableName b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (ColumnType b)
|
2022-04-06 01:08:43 +03:00
|
|
|
genColumnType genTableName genScalarType =
|
2021-11-10 14:12:01 +03:00
|
|
|
choice [columnScalar, columnEnumReference]
|
|
|
|
where
|
|
|
|
columnScalar = ColumnScalar <$> genScalarType
|
|
|
|
columnEnumReference =
|
|
|
|
ColumnEnumReference
|
2022-04-06 01:08:43 +03:00
|
|
|
<$> genEnumReference genTableName
|
2021-11-10 14:12:01 +03:00
|
|
|
|
|
|
|
genEnumReference ::
|
|
|
|
MonadGen m =>
|
|
|
|
m (TableName b) ->
|
|
|
|
m (EnumReference b)
|
2022-04-06 01:08:43 +03:00
|
|
|
genEnumReference genTableName =
|
2021-11-10 14:12:01 +03:00
|
|
|
EnumReference
|
|
|
|
<$> genTableName
|
|
|
|
<*> genHashMap
|
2022-04-06 01:08:43 +03:00
|
|
|
genEnumValue
|
|
|
|
genEnumValueInfo
|
2022-04-08 09:48:37 +03:00
|
|
|
defaultRange
|
2022-04-13 13:07:06 +03:00
|
|
|
<*> maybe
|
|
|
|
( genGName
|
|
|
|
defaultRange
|
|
|
|
)
|
2021-11-10 14:12:01 +03:00
|
|
|
|
2022-04-06 01:08:43 +03:00
|
|
|
genEnumValue :: MonadGen m => m EnumValue
|
2022-04-08 09:48:37 +03:00
|
|
|
genEnumValue = EnumValue <$> genGName defaultRange
|
2021-11-10 14:12:01 +03:00
|
|
|
|
2022-04-06 01:08:43 +03:00
|
|
|
genEnumValueInfo :: MonadGen m => m EnumValueInfo
|
2022-04-08 09:48:37 +03:00
|
|
|
genEnumValueInfo = EnumValueInfo <$> maybe (genArbitraryUnicodeText defaultRange)
|
2021-11-10 14:12:01 +03:00
|
|
|
|
|
|
|
genColumnInfo ::
|
|
|
|
MonadGen m =>
|
|
|
|
m (Column b) ->
|
|
|
|
m (TableName b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (ColumnInfo b)
|
|
|
|
genColumnInfo
|
|
|
|
genColumn
|
|
|
|
genTableName
|
2022-04-06 01:08:43 +03:00
|
|
|
genScalarType =
|
2021-11-10 14:12:01 +03:00
|
|
|
ColumnInfo
|
|
|
|
<$> genColumn
|
2022-04-08 09:48:37 +03:00
|
|
|
<*> genGName defaultRange
|
|
|
|
<*> integral defaultRange
|
2022-04-06 01:08:43 +03:00
|
|
|
<*> genColumnType genTableName genScalarType
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> bool_
|
2022-04-08 09:48:37 +03:00
|
|
|
<*> maybe (genDescription defaultRange)
|
2021-12-01 14:33:14 +03:00
|
|
|
<*> genColumnMutability
|
|
|
|
|
|
|
|
genColumnMutability :: MonadGen m => m ColumnMutability
|
|
|
|
genColumnMutability = ColumnMutability <$> bool <*> bool
|
2021-11-10 14:12:01 +03:00
|
|
|
|
|
|
|
genAnnotatedOrderByItemG ::
|
|
|
|
MonadGen m =>
|
|
|
|
m (BasicOrderType b) ->
|
|
|
|
m (NullsOrderType b) ->
|
|
|
|
m a ->
|
|
|
|
m (OrderByItemG b a)
|
|
|
|
genAnnotatedOrderByItemG genBasicOrderType genNullsOrderType genA =
|
|
|
|
OrderByItemG
|
|
|
|
<$> maybe genBasicOrderType
|
|
|
|
<*> genA
|
|
|
|
<*> maybe genNullsOrderType
|
|
|
|
|
|
|
|
genAnnotatedOrderByElement ::
|
|
|
|
MonadGen m =>
|
|
|
|
Eq (ScalarType b) =>
|
|
|
|
Eq (Column b) =>
|
|
|
|
Hashable (ScalarType b) =>
|
|
|
|
Hashable (Column b) =>
|
|
|
|
m (Column b) ->
|
|
|
|
m (TableName b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (FunctionName b) ->
|
|
|
|
m (XComputedField b) ->
|
|
|
|
m (BooleanOperators b a) ->
|
|
|
|
m a ->
|
|
|
|
m (AnnotatedOrderByElement b a)
|
|
|
|
genAnnotatedOrderByElement
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
2022-04-06 01:08:43 +03:00
|
|
|
genA =
|
2021-11-10 14:12:01 +03:00
|
|
|
choice
|
|
|
|
[ column,
|
|
|
|
objectRelation,
|
|
|
|
arrayAggregation,
|
|
|
|
computedField
|
|
|
|
]
|
|
|
|
where
|
|
|
|
column =
|
|
|
|
AOCColumn
|
|
|
|
<$> genColumnInfo
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
objectRelation =
|
|
|
|
AOCObjectRelation
|
2022-04-06 01:08:43 +03:00
|
|
|
<$> genRelInfo genTableName genColumn
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> genAnnBoolExp
|
|
|
|
( genAnnBoolExpFld
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
)
|
|
|
|
genTableName
|
|
|
|
<*> genAnnotatedOrderByElement
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
arrayAggregation =
|
|
|
|
AOCArrayAggregation
|
2022-04-06 01:08:43 +03:00
|
|
|
<$> genRelInfo genTableName genColumn
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> genAnnBoolExp
|
|
|
|
( genAnnBoolExpFld
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
)
|
|
|
|
genTableName
|
|
|
|
<*> genAnnotatedAggregateOrderBy
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
computedField =
|
|
|
|
AOCComputedField
|
|
|
|
<$> genComputedFieldOrderBy
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genTableName
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
|
|
|
|
genAnnotatedAggregateOrderBy ::
|
|
|
|
MonadGen m =>
|
|
|
|
m (Column b) ->
|
|
|
|
m (TableName b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (AnnotatedAggregateOrderBy b)
|
|
|
|
genAnnotatedAggregateOrderBy
|
|
|
|
genColumn
|
|
|
|
genTableName
|
2022-04-06 01:08:43 +03:00
|
|
|
genScalarType =
|
2021-11-10 14:12:01 +03:00
|
|
|
choice
|
|
|
|
[ pure AAOCount,
|
|
|
|
AAOOp
|
2022-04-08 09:48:37 +03:00
|
|
|
<$> genArbitraryUnicodeText defaultRange
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> genColumnInfo
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
]
|
|
|
|
|
|
|
|
genComputedFieldOrderBy ::
|
|
|
|
MonadGen m =>
|
|
|
|
Eq (ScalarType b) =>
|
|
|
|
Hashable (ScalarType b) =>
|
|
|
|
Eq (Column b) =>
|
|
|
|
Hashable (Column b) =>
|
|
|
|
m (Column b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (TableName b) ->
|
|
|
|
m (FunctionName b) ->
|
|
|
|
m (XComputedField b) ->
|
|
|
|
m (BooleanOperators b a) ->
|
|
|
|
m a ->
|
|
|
|
m (ComputedFieldOrderBy b a)
|
|
|
|
genComputedFieldOrderBy
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genTableName
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
2022-04-06 01:08:43 +03:00
|
|
|
genA =
|
2021-11-10 14:12:01 +03:00
|
|
|
ComputedFieldOrderBy
|
|
|
|
<$> genXComputedField
|
2022-04-06 01:08:43 +03:00
|
|
|
<*> genComputedFieldName
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> genFunctionName
|
|
|
|
<*> genFunctionArgsExpG
|
2021-12-13 19:48:10 +03:00
|
|
|
(genArgumentExp genA)
|
2021-11-10 14:12:01 +03:00
|
|
|
<*> genComputedFieldOrderByElement
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genTableName
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
|
|
|
|
genComputedFieldOrderByElement ::
|
|
|
|
MonadGen m =>
|
|
|
|
Eq (ScalarType b) =>
|
|
|
|
Hashable (ScalarType b) =>
|
|
|
|
Eq (Column b) =>
|
|
|
|
Hashable (Column b) =>
|
|
|
|
m (Column b) ->
|
|
|
|
m (ScalarType b) ->
|
|
|
|
m (TableName b) ->
|
|
|
|
m (FunctionName b) ->
|
|
|
|
m (XComputedField b) ->
|
|
|
|
m (BooleanOperators b a) ->
|
|
|
|
m a ->
|
|
|
|
m (ComputedFieldOrderByElement b a)
|
|
|
|
genComputedFieldOrderByElement
|
|
|
|
genColumn
|
|
|
|
genScalarType
|
|
|
|
genTableName
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
2022-04-06 01:08:43 +03:00
|
|
|
genA =
|
2021-11-10 14:12:01 +03:00
|
|
|
choice
|
|
|
|
[ CFOBEScalar <$> genScalarType,
|
|
|
|
CFOBETableAggregation
|
|
|
|
<$> genTableName
|
|
|
|
<*> genAnnBoolExp
|
|
|
|
( genAnnBoolExpFld
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
genFunctionName
|
|
|
|
genXComputedField
|
|
|
|
genBooleanOperators
|
|
|
|
genA
|
|
|
|
)
|
|
|
|
genTableName
|
|
|
|
<*> genAnnotatedAggregateOrderBy
|
|
|
|
genColumn
|
|
|
|
genTableName
|
|
|
|
genScalarType
|
|
|
|
]
|
2022-04-06 01:08:43 +03:00
|
|
|
|
|
|
|
genIdentifier :: MonadGen m => m FIIdentifier
|
2022-04-08 09:48:37 +03:00
|
|
|
genIdentifier = Hasura.RQL.IR.Select.FIIdentifier <$> genArbitraryUnicodeText defaultRange
|