{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Hasura.Backends.DataConnector.Adapter.Schema () where
import Data.Has
import Data.List.NonEmpty qualified as NE
import Data.Text.Casing (GQLNameIdentifier)
import Data.Text.Extended ((<<>))
import Data.Text.NonEmpty qualified as NET
import Hasura.Backends.DataConnector.Adapter.Types qualified as Adapter
import Hasura.Backends.DataConnector.IR.Aggregate qualified as IR.A
import Hasura.Backends.DataConnector.IR.Column qualified as IR.C
import Hasura.Backends.DataConnector.IR.OrderBy qualified as IR.O
import Hasura.Backends.DataConnector.IR.Scalar.Type qualified as IR.S.T
import Hasura.Backends.DataConnector.IR.Scalar.Value qualified as IR.S.V
import Hasura.Base.Error
import Hasura.GraphQL.Parser.Class
import Hasura.GraphQL.Schema.Backend (BackendSchema (..), BackendTableSelectSchema (..), ComparisonExp, MonadBuildSchema)
import Hasura.GraphQL.Schema.BoolExp qualified as GS.BE
import Hasura.GraphQL.Schema.Build qualified as GS.B
import Hasura.GraphQL.Schema.Common qualified as GS.C
import Hasura.GraphQL.Schema.NamingCase
import Hasura.GraphQL.Schema.Options (SchemaOptions)
import Hasura.GraphQL.Schema.Options qualified as Options
import Hasura.GraphQL.Schema.Parser qualified as P
import Hasura.GraphQL.Schema.Select qualified as GS.S
import Hasura.Name qualified as Name
import Hasura.Prelude
import Hasura.RQL.IR.Select qualified as IR
import Hasura.RQL.IR.Value qualified as IR
import Hasura.RQL.Types.Backend qualified as RQL
import Hasura.RQL.Types.Column qualified as RQL
import Hasura.RQL.Types.Source qualified as RQL
import Hasura.RQL.Types.SourceCustomization qualified as RQL
import Hasura.RQL.Types.Table qualified as RQL
import Hasura.SQL.Backend (BackendType (..))
import Language.GraphQL.Draft.Syntax qualified as GQL
instance BackendSchema 'DataConnector where
buildTableQueryAndSubscriptionFields :: MkRootFieldName
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> m ([FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))],
[FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))],
Maybe (Name, Parser 'Output n (ApolloFederationParserFunction n)))
buildTableQueryAndSubscriptionFields = MkRootFieldName
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> m ([FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))],
[FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))],
Maybe (Name, Parser 'Output n (ApolloFederationParserFunction n)))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(MonadBuildSchema b r m n, AggregationPredicatesSchema b,
BackendTableSelectSchema b) =>
MkRootFieldName
-> SourceInfo b
-> TableName b
-> TableInfo b
-> GQLNameIdentifier
-> m ([FieldParser
n
(QueryDB
b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))],
[FieldParser
n
(QueryDB
b (RemoteRelationshipField UnpreparedValue) (UnpreparedValue b))],
Maybe (Name, Parser 'Output n (ApolloFederationParserFunction n)))
GS.B.buildTableQueryAndSubscriptionFields
buildTableRelayQueryFields :: MkRootFieldName
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> NESeq (ColumnInfo 'DataConnector)
-> m [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
buildTableRelayQueryFields = MkRootFieldName
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> NESeq (ColumnInfo 'DataConnector)
-> m [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
forall r (m :: * -> *) (n :: * -> *) a.
MonadBuildSchema 'DataConnector r m n =>
MkRootFieldName
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> NESeq (ColumnInfo 'DataConnector)
-> m [FieldParser n a]
experimentalBuildTableRelayQueryFields
buildFunctionQueryFields :: MkRootFieldName
-> SourceInfo 'DataConnector
-> FunctionName 'DataConnector
-> FunctionInfo 'DataConnector
-> TableName 'DataConnector
-> m [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
buildFunctionQueryFields MkRootFieldName
_ SourceInfo 'DataConnector
_ FunctionName 'DataConnector
_ FunctionInfo 'DataConnector
_ TableName 'DataConnector
_ = [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
-> m [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
forall (f :: * -> *) a. Applicative f => a -> f a
pure []
buildFunctionRelayQueryFields :: MkRootFieldName
-> SourceInfo 'DataConnector
-> FunctionName 'DataConnector
-> FunctionInfo 'DataConnector
-> TableName 'DataConnector
-> NESeq (ColumnInfo 'DataConnector)
-> m [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
buildFunctionRelayQueryFields MkRootFieldName
_ SourceInfo 'DataConnector
_ FunctionName 'DataConnector
_ FunctionInfo 'DataConnector
_ TableName 'DataConnector
_ NESeq (ColumnInfo 'DataConnector)
_ = [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
-> m [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
forall (f :: * -> *) a. Applicative f => a -> f a
pure []
buildFunctionMutationFields :: MkRootFieldName
-> SourceInfo 'DataConnector
-> FunctionName 'DataConnector
-> FunctionInfo 'DataConnector
-> TableName 'DataConnector
-> m [FieldParser
n
(MutationDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
buildFunctionMutationFields MkRootFieldName
_ SourceInfo 'DataConnector
_ FunctionName 'DataConnector
_ FunctionInfo 'DataConnector
_ TableName 'DataConnector
_ = [FieldParser
n
(MutationDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
-> m [FieldParser
n
(MutationDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
forall (f :: * -> *) a. Applicative f => a -> f a
pure []
buildTableInsertMutationFields :: MkRootFieldName
-> Scenario
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> m [FieldParser
n
(AnnotatedInsert
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
buildTableInsertMutationFields MkRootFieldName
_ Scenario
_ SourceInfo 'DataConnector
_ TableName 'DataConnector
_ TableInfo 'DataConnector
_ GQLNameIdentifier
_ = [FieldParser
n
(AnnotatedInsert
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
-> m [FieldParser
n
(AnnotatedInsert
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
forall (f :: * -> *) a. Applicative f => a -> f a
pure []
buildTableUpdateMutationFields :: MkRootFieldName
-> Scenario
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> m [FieldParser
n
(AnnotatedUpdateG
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
buildTableUpdateMutationFields MkRootFieldName
_ Scenario
_ SourceInfo 'DataConnector
_ TableName 'DataConnector
_ TableInfo 'DataConnector
_ GQLNameIdentifier
_ = [FieldParser
n
(AnnotatedUpdateG
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
-> m [FieldParser
n
(AnnotatedUpdateG
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
forall (f :: * -> *) a. Applicative f => a -> f a
pure []
buildTableDeleteMutationFields :: MkRootFieldName
-> Scenario
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> m [FieldParser
n
(AnnDelG
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
buildTableDeleteMutationFields MkRootFieldName
_ Scenario
_ SourceInfo 'DataConnector
_ TableName 'DataConnector
_ TableInfo 'DataConnector
_ GQLNameIdentifier
_ = [FieldParser
n
(AnnDelG
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
-> m [FieldParser
n
(AnnDelG
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
forall (f :: * -> *) a. Applicative f => a -> f a
pure []
buildTableStreamingSubscriptionFields :: MkRootFieldName
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> m [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
buildTableStreamingSubscriptionFields MkRootFieldName
_ SourceInfo 'DataConnector
_ TableName 'DataConnector
_ TableInfo 'DataConnector
_ GQLNameIdentifier
_ = [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
-> m [FieldParser
n
(QueryDB
'DataConnector
(RemoteRelationshipField UnpreparedValue)
(UnpreparedValue 'DataConnector))]
forall (f :: * -> *) a. Applicative f => a -> f a
pure []
relayExtension :: Maybe (XRelay 'DataConnector)
relayExtension = Maybe (XRelay 'DataConnector)
forall a. Maybe a
Nothing
nodesAggExtension :: Maybe (XNodesAgg 'DataConnector)
nodesAggExtension = () -> Maybe ()
forall a. a -> Maybe a
Just ()
streamSubscriptionExtension :: Maybe (XStreamingSubscription 'DataConnector)
streamSubscriptionExtension = Maybe (XStreamingSubscription 'DataConnector)
forall a. Maybe a
Nothing
columnParser :: ColumnType 'DataConnector
-> Nullability
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
columnParser = ColumnType 'DataConnector
-> Nullability
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
forall (n :: * -> *) (m :: * -> *).
(MonadParse n, MonadError QErr m) =>
ColumnType 'DataConnector
-> Nullability
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
columnParser'
scalarSelectionArgumentsParser :: ColumnType 'DataConnector
-> InputFieldsParser
n (Maybe (ScalarSelectionArguments 'DataConnector))
scalarSelectionArgumentsParser ColumnType 'DataConnector
_ = Maybe Void -> InputFieldsParser MetadataObjId n (Maybe Void)
forall (f :: * -> *) a. Applicative f => a -> f a
pure Maybe Void
forall a. Maybe a
Nothing
orderByOperators :: SourceInfo 'DataConnector
-> NamingCase
-> (Name,
NonEmpty
(Definition EnumValueInfo,
(BasicOrderType 'DataConnector, NullsOrderType 'DataConnector)))
orderByOperators = SourceInfo 'DataConnector
-> NamingCase
-> (Name,
NonEmpty
(Definition EnumValueInfo,
(BasicOrderType 'DataConnector, NullsOrderType 'DataConnector)))
orderByOperators'
comparisonExps :: ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector])
comparisonExps = ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector])
forall (m :: * -> *) (n :: * -> *) r.
(BackendSchema 'DataConnector, MonadMemoize m, MonadParse n,
MonadError QErr m, MonadReader r m, Has SchemaOptions r,
Has NamingCase r) =>
ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector])
comparisonExps'
countTypeInput :: Maybe (Parser 'Both n (Column 'DataConnector))
-> InputFieldsParser n (CountDistinct -> CountType 'DataConnector)
countTypeInput = Maybe (Parser 'Both n (Column 'DataConnector))
-> InputFieldsParser n (CountDistinct -> CountType 'DataConnector)
forall (n :: * -> *).
MonadParse n =>
Maybe (Parser 'Both n Name)
-> InputFieldsParser n (CountDistinct -> CountAggregate)
countTypeInput'
aggregateOrderByCountType :: ScalarType 'DataConnector
aggregateOrderByCountType = Type
ScalarType 'DataConnector
IR.S.T.Number
computedField :: SourceInfo 'DataConnector
-> ComputedFieldInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> m (Maybe (FieldParser n (AnnotatedField 'DataConnector)))
computedField =
[Char]
-> SourceInfo 'DataConnector
-> ComputedFieldInfo 'DataConnector
-> Name
-> TableInfo 'DataConnector
-> m (Maybe (FieldParser n (AnnotatedField 'DataConnector)))
forall a. HasCallStack => [Char] -> a
error [Char]
"computedField: not implemented for the Data Connector backend."
instance BackendTableSelectSchema 'DataConnector where
tableArguments :: SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> m (InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector)))
tableArguments = SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> m (InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector)))
forall r (m :: * -> *) (n :: * -> *).
MonadBuildSchema 'DataConnector r m n =>
SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> m (InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector)))
tableArgs'
selectTable :: SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> Name
-> Maybe Description
-> m (Maybe (FieldParser n (SelectExp 'DataConnector)))
selectTable = SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> Name
-> Maybe Description
-> m (Maybe (FieldParser n (SelectExp 'DataConnector)))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(MonadBuildSchema b r m n, BackendTableSelectSchema b) =>
SourceInfo b
-> TableInfo b
-> Name
-> Maybe Description
-> m (Maybe (FieldParser n (SelectExp b)))
GS.S.defaultSelectTable
selectTableAggregate :: SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> Name
-> Maybe Description
-> m (Maybe (FieldParser n (AggSelectExp 'DataConnector)))
selectTableAggregate = SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> Name
-> Maybe Description
-> m (Maybe (FieldParser n (AggSelectExp 'DataConnector)))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(MonadBuildSchema b r m n, BackendTableSelectSchema b) =>
SourceInfo b
-> TableInfo b
-> Name
-> Maybe Description
-> m (Maybe (FieldParser n (AggSelectExp b)))
GS.S.defaultSelectTableAggregate
tableSelectionSet :: SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> m (Maybe (Parser 'Output n (AnnotatedFields 'DataConnector)))
tableSelectionSet = SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> m (Maybe (Parser 'Output n (AnnotatedFields 'DataConnector)))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(AggregationPredicatesSchema b, BackendTableSelectSchema b,
Eq (AnnBoolExp b (UnpreparedValue b)), MonadBuildSchema b r m n) =>
SourceInfo b
-> TableInfo b -> m (Maybe (Parser 'Output n (AnnotatedFields b)))
GS.S.defaultTableSelectionSet
experimentalBuildTableRelayQueryFields ::
MonadBuildSchema 'DataConnector r m n =>
RQL.MkRootFieldName ->
RQL.SourceInfo 'DataConnector ->
RQL.TableName 'DataConnector ->
RQL.TableInfo 'DataConnector ->
GQLNameIdentifier ->
NESeq (RQL.ColumnInfo 'DataConnector) ->
m [P.FieldParser n a]
experimentalBuildTableRelayQueryFields :: MkRootFieldName
-> SourceInfo 'DataConnector
-> TableName 'DataConnector
-> TableInfo 'DataConnector
-> GQLNameIdentifier
-> NESeq (ColumnInfo 'DataConnector)
-> m [FieldParser n a]
experimentalBuildTableRelayQueryFields MkRootFieldName
_mkRootFieldName SourceInfo 'DataConnector
_sourceName TableName 'DataConnector
_tableName TableInfo 'DataConnector
_tableInfo GQLNameIdentifier
_gqlName NESeq (ColumnInfo 'DataConnector)
_pkeyColumns =
[FieldParser n a] -> m [FieldParser n a]
forall (f :: * -> *) a. Applicative f => a -> f a
pure []
columnParser' ::
(MonadParse n, MonadError QErr m) =>
RQL.ColumnType 'DataConnector ->
GQL.Nullability ->
m (P.Parser 'P.Both n (IR.ValueWithOrigin (RQL.ColumnValue 'DataConnector)))
columnParser' :: ColumnType 'DataConnector
-> Nullability
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
columnParser' ColumnType 'DataConnector
columnType (GQL.Nullability Bool
isNullable) = do
Parser MetadataObjId 'Both n Value
parser <- case ColumnType 'DataConnector
columnType of
RQL.ColumnScalar ScalarType 'DataConnector
IR.S.T.String -> Parser MetadataObjId 'Both n Value
-> m (Parser MetadataObjId 'Both n Value)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Text -> Value
IR.S.V.String (Text -> Value)
-> Parser MetadataObjId 'Both n Text
-> Parser MetadataObjId 'Both n Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser MetadataObjId 'Both n Text
forall (m :: * -> *) origin.
MonadParse m =>
Parser origin 'Both m Text
P.string)
RQL.ColumnScalar ScalarType 'DataConnector
IR.S.T.Number -> Parser MetadataObjId 'Both n Value
-> m (Parser MetadataObjId 'Both n Value)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Scientific -> Value
IR.S.V.Number (Scientific -> Value)
-> Parser MetadataObjId 'Both n Scientific
-> Parser MetadataObjId 'Both n Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser MetadataObjId 'Both n Scientific
forall (m :: * -> *) origin.
MonadParse m =>
Parser origin 'Both m Scientific
P.scientific)
RQL.ColumnScalar ScalarType 'DataConnector
IR.S.T.Bool -> Parser MetadataObjId 'Both n Value
-> m (Parser MetadataObjId 'Both n Value)
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Bool -> Value
IR.S.V.Boolean (Bool -> Value)
-> Parser MetadataObjId 'Both n Bool
-> Parser MetadataObjId 'Both n Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser MetadataObjId 'Both n Bool
forall (m :: * -> *) origin.
MonadParse m =>
Parser origin 'Both m Bool
P.boolean)
ColumnType 'DataConnector
_ -> Code -> Text -> m (Parser MetadataObjId 'Both n Value)
forall (m :: * -> *) a. QErrM m => Code -> Text -> m a
throw400 Code
NotSupported Text
"This column type is unsupported by the Data Connector backend"
Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector))))
-> (Parser MetadataObjId 'Both n Value
-> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
-> Parser MetadataObjId 'Both n Value
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser 'Both n (ColumnValue 'DataConnector)
-> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
forall (m :: * -> *) a.
MonadParse m =>
Parser 'Both m a -> Parser 'Both m (ValueWithOrigin a)
GS.C.peelWithOrigin (Parser 'Both n (ColumnValue 'DataConnector)
-> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
-> (Parser MetadataObjId 'Both n Value
-> Parser 'Both n (ColumnValue 'DataConnector))
-> Parser MetadataObjId 'Both n Value
-> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Value -> ColumnValue 'DataConnector)
-> Parser MetadataObjId 'Both n Value
-> Parser 'Both n (ColumnValue 'DataConnector)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ColumnType 'DataConnector
-> ScalarValue 'DataConnector -> ColumnValue 'DataConnector
forall (b :: BackendType).
ColumnType b -> ScalarValue b -> ColumnValue b
RQL.ColumnValue ColumnType 'DataConnector
columnType) (Parser MetadataObjId 'Both n Value
-> Parser 'Both n (ColumnValue 'DataConnector))
-> (Parser MetadataObjId 'Both n Value
-> Parser MetadataObjId 'Both n Value)
-> Parser MetadataObjId 'Both n Value
-> Parser 'Both n (ColumnValue 'DataConnector)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser MetadataObjId 'Both n Value
-> Parser MetadataObjId 'Both n Value
forall (m :: * -> *).
MonadParse m =>
Parser 'Both m Value -> Parser 'Both m Value
possiblyNullable (Parser MetadataObjId 'Both n Value
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector))))
-> Parser MetadataObjId 'Both n Value
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
forall a b. (a -> b) -> a -> b
$ Parser MetadataObjId 'Both n Value
parser
where
possiblyNullable ::
MonadParse m =>
P.Parser 'P.Both m IR.S.V.Value ->
P.Parser 'P.Both m IR.S.V.Value
possiblyNullable :: Parser 'Both m Value -> Parser 'Both m Value
possiblyNullable
| Bool
isNullable = (Maybe Value -> Value)
-> Parser MetadataObjId 'Both m (Maybe Value)
-> Parser 'Both m Value
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (Value -> Maybe Value -> Value
forall a. a -> Maybe a -> a
fromMaybe Value
IR.S.V.Null) (Parser MetadataObjId 'Both m (Maybe Value)
-> Parser 'Both m Value)
-> (Parser 'Both m Value
-> Parser MetadataObjId 'Both m (Maybe Value))
-> Parser 'Both m Value
-> Parser 'Both m Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser 'Both m Value -> Parser MetadataObjId 'Both m (Maybe Value)
forall origin (k :: Kind) (m :: * -> *) a.
(MonadParse m, 'Input <: k) =>
Parser origin k m a -> Parser origin k m (Maybe a)
P.nullable
| Bool
otherwise = Parser 'Both m Value -> Parser 'Both m Value
forall a. a -> a
id
orderByOperators' :: RQL.SourceInfo 'DataConnector -> NamingCase -> (GQL.Name, NonEmpty (P.Definition P.EnumValueInfo, (RQL.BasicOrderType 'DataConnector, RQL.NullsOrderType 'DataConnector)))
orderByOperators' :: SourceInfo 'DataConnector
-> NamingCase
-> (Name,
NonEmpty
(Definition EnumValueInfo,
(BasicOrderType 'DataConnector, NullsOrderType 'DataConnector)))
orderByOperators' RQL.SourceInfo {SourceConfig 'DataConnector
_siConfiguration :: forall (b :: BackendType). SourceInfo b -> SourceConfig b
_siConfiguration :: SourceConfig 'DataConnector
_siConfiguration} NamingCase
_tCase =
let dcName :: DataConnectorName
dcName = SourceConfig -> DataConnectorName
Adapter._scDataConnectorName SourceConfig
SourceConfig 'DataConnector
_siConfiguration
orderBy :: Name
orderBy = Name -> Maybe Name -> Name
forall a. a -> Maybe a -> a
fromMaybe Name
Name._order_by (Maybe Name -> Name) -> Maybe Name -> Name
forall a b. (a -> b) -> a -> b
$ Text -> Maybe Name
GQL.mkName (Text -> Maybe Name) -> Text -> Maybe Name
forall a b. (a -> b) -> a -> b
$ NonEmptyText -> Text
NET.unNonEmptyText (DataConnectorName -> NonEmptyText
Adapter.unDataConnectorName DataConnectorName
dcName) Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
"_order_by"
in (Name
orderBy,) (NonEmpty (Definition EnumValueInfo, (OrderDirection, ()))
-> (Name,
NonEmpty (Definition EnumValueInfo, (OrderDirection, ()))))
-> NonEmpty (Definition EnumValueInfo, (OrderDirection, ()))
-> (Name,
NonEmpty (Definition EnumValueInfo, (OrderDirection, ())))
forall a b. (a -> b) -> a -> b
$
[(Definition EnumValueInfo, (OrderDirection, ()))]
-> NonEmpty (Definition EnumValueInfo, (OrderDirection, ()))
forall a. [a] -> NonEmpty a
NE.fromList
[ ( Name -> Description -> Definition EnumValueInfo
forall origin.
Name -> Description -> Definition origin EnumValueInfo
define $$(GQL.litName "asc") Description
"in ascending order",
(OrderDirection
IR.O.Ascending, ())
),
( Name -> Description -> Definition EnumValueInfo
forall origin.
Name -> Description -> Definition origin EnumValueInfo
define $$(GQL.litName "desc") Description
"in descending order",
(OrderDirection
IR.O.Descending, ())
)
]
where
define :: Name -> Description -> Definition origin EnumValueInfo
define Name
name Description
desc = Name
-> Maybe Description
-> Maybe origin
-> [Directive Void]
-> EnumValueInfo
-> Definition origin EnumValueInfo
forall origin a.
Name
-> Maybe Description
-> Maybe origin
-> [Directive Void]
-> a
-> Definition origin a
P.Definition Name
name (Description -> Maybe Description
forall a. a -> Maybe a
Just Description
desc) Maybe origin
forall a. Maybe a
Nothing [] EnumValueInfo
P.EnumValueInfo
comparisonExps' ::
forall m n r.
( BackendSchema 'DataConnector,
P.MonadMemoize m,
MonadParse n,
MonadError QErr m,
MonadReader r m,
Has SchemaOptions r,
Has NamingCase r
) =>
RQL.ColumnType 'DataConnector ->
m (P.Parser 'P.Input n [ComparisonExp 'DataConnector])
comparisonExps' :: ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector])
comparisonExps' = Name
-> (ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector]))
-> ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector])
forall (m :: * -> *) a (p :: (* -> *) -> * -> *) (n :: * -> *) b.
(MonadMemoize m, Ord a, Typeable a, Typeable p, MonadParse n,
Typeable b) =>
Name -> (a -> m (p n b)) -> a -> m (p n b)
P.memoize 'comparisonExps' ((ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector]))
-> ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector]))
-> (ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector]))
-> ColumnType 'DataConnector
-> m (Parser 'Input n [ComparisonExp 'DataConnector])
forall a b. (a -> b) -> a -> b
$ \ColumnType 'DataConnector
columnType -> do
NamingCase
tCase <- (r -> NamingCase) -> m NamingCase
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks r -> NamingCase
forall a t. Has a t => t -> a
getter
DangerouslyCollapseBooleans
collapseIfNull <- (SchemaOptions -> DangerouslyCollapseBooleans)
-> m DangerouslyCollapseBooleans
forall r (m :: * -> *) a b.
(MonadReader r m, Has a r) =>
(a -> b) -> m b
GS.C.retrieve SchemaOptions -> DangerouslyCollapseBooleans
Options.soDangerousBooleanCollapse
Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
typedParser <- ColumnType 'DataConnector
-> Nullability
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
forall (n :: * -> *) (m :: * -> *).
(MonadParse n, MonadError QErr m) =>
ColumnType 'DataConnector
-> Nullability
-> m (Parser
'Both n (ValueWithOrigin (ColumnValue 'DataConnector)))
columnParser' ColumnType 'DataConnector
columnType (Bool -> Nullability
GQL.Nullability Bool
False)
let name :: Name
name = Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
-> Name
forall a. HasName a => a -> Name
P.getName Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
typedParser Name -> Name -> Name
forall a. Semigroup a => a -> a -> a
<> $$(GQL.litName "_Dynamic_comparison_exp")
desc :: Description
desc =
Text -> Description
GQL.Description (Text -> Description) -> Text -> Description
forall a b. (a -> b) -> a -> b
$
Text
"Boolean expression to compare columns of type "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
-> Name
forall a. HasName a => a -> Name
P.getName Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
typedParser
Name -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
". All fields are combined with logical 'AND'."
columnListParser :: Parser MetadataObjId 'Both n [ColumnValue 'DataConnector]
columnListParser = (ValueWithOrigin (ColumnValue 'DataConnector)
-> ColumnValue 'DataConnector)
-> [ValueWithOrigin (ColumnValue 'DataConnector)]
-> [ColumnValue 'DataConnector]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ValueWithOrigin (ColumnValue 'DataConnector)
-> ColumnValue 'DataConnector
forall a. ValueWithOrigin a -> a
IR.openValueOrigin ([ValueWithOrigin (ColumnValue 'DataConnector)]
-> [ColumnValue 'DataConnector])
-> Parser
MetadataObjId
'Both
n
[ValueWithOrigin (ColumnValue 'DataConnector)]
-> Parser MetadataObjId 'Both n [ColumnValue 'DataConnector]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
-> Parser
MetadataObjId
'Both
n
[ValueWithOrigin (ColumnValue 'DataConnector)]
forall origin (k :: Kind) (m :: * -> *) a.
(MonadParse m, 'Input <: k) =>
Parser origin k m a -> Parser origin k m [a]
P.list Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
typedParser
Parser 'Input n [ComparisonExp 'DataConnector]
-> m (Parser 'Input n [ComparisonExp 'DataConnector])
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Parser 'Input n [ComparisonExp 'DataConnector]
-> m (Parser 'Input n [ComparisonExp 'DataConnector]))
-> Parser 'Input n [ComparisonExp 'DataConnector]
-> m (Parser 'Input n [ComparisonExp 'DataConnector])
forall a b. (a -> b) -> a -> b
$
Name
-> Maybe Description
-> InputFieldsParser MetadataObjId n [ComparisonExp 'DataConnector]
-> Parser 'Input n [ComparisonExp 'DataConnector]
forall (m :: * -> *) origin a.
MonadParse m =>
Name
-> Maybe Description
-> InputFieldsParser origin m a
-> Parser origin 'Input m a
P.object Name
name (Description -> Maybe Description
forall a. a -> Maybe a
Just Description
desc) (InputFieldsParser MetadataObjId n [ComparisonExp 'DataConnector]
-> Parser 'Input n [ComparisonExp 'DataConnector])
-> InputFieldsParser MetadataObjId n [ComparisonExp 'DataConnector]
-> Parser 'Input n [ComparisonExp 'DataConnector]
forall a b. (a -> b) -> a -> b
$
([Maybe (ComparisonExp 'DataConnector)]
-> [ComparisonExp 'DataConnector])
-> InputFieldsParser
MetadataObjId n [Maybe (ComparisonExp 'DataConnector)]
-> InputFieldsParser MetadataObjId n [ComparisonExp 'DataConnector]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [Maybe (ComparisonExp 'DataConnector)]
-> [ComparisonExp 'DataConnector]
forall (f :: * -> *) a. Filterable f => f (Maybe a) -> f a
catMaybes (InputFieldsParser
MetadataObjId n [Maybe (ComparisonExp 'DataConnector)]
-> InputFieldsParser
MetadataObjId n [ComparisonExp 'DataConnector])
-> InputFieldsParser
MetadataObjId n [Maybe (ComparisonExp 'DataConnector)]
-> InputFieldsParser MetadataObjId n [ComparisonExp 'DataConnector]
forall a b. (a -> b) -> a -> b
$
[InputFieldsParser
MetadataObjId n (Maybe (ComparisonExp 'DataConnector))]
-> InputFieldsParser
MetadataObjId n [Maybe (ComparisonExp 'DataConnector)]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
sequenceA ([InputFieldsParser
MetadataObjId n (Maybe (ComparisonExp 'DataConnector))]
-> InputFieldsParser
MetadataObjId n [Maybe (ComparisonExp 'DataConnector)])
-> [InputFieldsParser
MetadataObjId n (Maybe (ComparisonExp 'DataConnector))]
-> InputFieldsParser
MetadataObjId n [Maybe (ComparisonExp 'DataConnector)]
forall a b. (a -> b) -> a -> b
$
[[InputFieldsParser
MetadataObjId n (Maybe (ComparisonExp 'DataConnector))]]
-> [InputFieldsParser
MetadataObjId n (Maybe (ComparisonExp 'DataConnector))]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
[ NamingCase
-> DangerouslyCollapseBooleans
-> Parser 'Both n (UnpreparedValue 'DataConnector)
-> Parser 'Both n (UnpreparedValue 'DataConnector)
-> [InputFieldsParser
MetadataObjId n (Maybe (ComparisonExp 'DataConnector))]
forall (n :: * -> *) (k :: Kind) (b :: BackendType).
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> Parser k n (UnpreparedValue b)
-> Parser k n (UnpreparedValue b)
-> [InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))]
GS.BE.equalityOperators
NamingCase
tCase
DangerouslyCollapseBooleans
collapseIfNull
(ValueWithOrigin (ColumnValue 'DataConnector)
-> UnpreparedValue 'DataConnector
forall (b :: BackendType).
ValueWithOrigin (ColumnValue b) -> UnpreparedValue b
IR.mkParameter (ValueWithOrigin (ColumnValue 'DataConnector)
-> UnpreparedValue 'DataConnector)
-> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
-> Parser 'Both n (UnpreparedValue 'DataConnector)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
typedParser)
([ColumnValue 'DataConnector] -> UnpreparedValue 'DataConnector
mkListLiteral ([ColumnValue 'DataConnector] -> UnpreparedValue 'DataConnector)
-> Parser MetadataObjId 'Both n [ColumnValue 'DataConnector]
-> Parser 'Both n (UnpreparedValue 'DataConnector)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser MetadataObjId 'Both n [ColumnValue 'DataConnector]
columnListParser),
NamingCase
-> DangerouslyCollapseBooleans
-> Parser 'Both n (UnpreparedValue 'DataConnector)
-> [InputFieldsParser
MetadataObjId n (Maybe (ComparisonExp 'DataConnector))]
forall (n :: * -> *) (k :: Kind) (b :: BackendType).
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> Parser k n (UnpreparedValue b)
-> [InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))]
GS.BE.comparisonOperators
NamingCase
tCase
DangerouslyCollapseBooleans
collapseIfNull
(ValueWithOrigin (ColumnValue 'DataConnector)
-> UnpreparedValue 'DataConnector
forall (b :: BackendType).
ValueWithOrigin (ColumnValue b) -> UnpreparedValue b
IR.mkParameter (ValueWithOrigin (ColumnValue 'DataConnector)
-> UnpreparedValue 'DataConnector)
-> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
-> Parser 'Both n (UnpreparedValue 'DataConnector)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser 'Both n (ValueWithOrigin (ColumnValue 'DataConnector))
typedParser)
]
where
mkListLiteral :: [RQL.ColumnValue 'DataConnector] -> IR.UnpreparedValue 'DataConnector
mkListLiteral :: [ColumnValue 'DataConnector] -> UnpreparedValue 'DataConnector
mkListLiteral [ColumnValue 'DataConnector]
columnValues =
Literal -> UnpreparedValue 'DataConnector
forall (b :: BackendType). SQLExpression b -> UnpreparedValue b
IR.UVLiteral (Literal -> UnpreparedValue 'DataConnector)
-> ([Value] -> Literal)
-> [Value]
-> UnpreparedValue 'DataConnector
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Value] -> Literal
IR.S.V.ArrayLiteral ([Value] -> UnpreparedValue 'DataConnector)
-> [Value] -> UnpreparedValue 'DataConnector
forall a b. (a -> b) -> a -> b
$ ColumnValue 'DataConnector -> Value
forall (b :: BackendType). ColumnValue b -> ScalarValue b
RQL.cvValue (ColumnValue 'DataConnector -> Value)
-> [ColumnValue 'DataConnector] -> [Value]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ColumnValue 'DataConnector]
columnValues
tableArgs' ::
forall r m n.
MonadBuildSchema 'DataConnector r m n =>
RQL.SourceInfo 'DataConnector ->
RQL.TableInfo 'DataConnector ->
m (P.InputFieldsParser n (IR.SelectArgsG 'DataConnector (IR.UnpreparedValue 'DataConnector)))
tableArgs' :: SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> m (InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector)))
tableArgs' SourceInfo 'DataConnector
sourceName TableInfo 'DataConnector
tableInfo = do
InputFieldsParser
n
(Maybe
(AnnBoolExp 'DataConnector (UnpreparedValue 'DataConnector)))
whereParser <- SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> m (InputFieldsParser
n
(Maybe
(AnnBoolExp 'DataConnector (UnpreparedValue 'DataConnector))))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(AggregationPredicatesSchema b, MonadBuildSchema b r m n) =>
SourceInfo b
-> TableInfo b
-> m (InputFieldsParser
n (Maybe (AnnBoolExp b (UnpreparedValue b))))
GS.S.tableWhereArg SourceInfo 'DataConnector
sourceName TableInfo 'DataConnector
tableInfo
InputFieldsParser
n
(Maybe
(NonEmpty
(AnnotatedOrderByItemG
'DataConnector (UnpreparedValue 'DataConnector))))
orderByParser <- SourceInfo 'DataConnector
-> TableInfo 'DataConnector
-> m (InputFieldsParser
n
(Maybe
(NonEmpty
(AnnotatedOrderByItemG
'DataConnector (UnpreparedValue 'DataConnector)))))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
MonadBuildSchema b r m n =>
SourceInfo b
-> TableInfo b
-> m (InputFieldsParser
n (Maybe (NonEmpty (AnnotatedOrderByItemG b (UnpreparedValue b)))))
GS.S.tableOrderByArg SourceInfo 'DataConnector
sourceName TableInfo 'DataConnector
tableInfo
let mkSelectArgs :: Maybe (AnnBoolExp b v)
-> Maybe (NonEmpty (AnnotatedOrderByItemG b v))
-> Maybe Int
-> Maybe Int64
-> SelectArgsG b v
mkSelectArgs Maybe (AnnBoolExp b v)
whereArg Maybe (NonEmpty (AnnotatedOrderByItemG b v))
orderByArg Maybe Int
limitArg Maybe Int64
offsetArg =
SelectArgs :: forall (b :: BackendType) v.
Maybe (AnnBoolExp b v)
-> Maybe (NonEmpty (AnnotatedOrderByItemG b v))
-> Maybe Int
-> Maybe Int64
-> Maybe (NonEmpty (Column b))
-> SelectArgsG b v
IR.SelectArgs
{ $sel:_saWhere:SelectArgs :: Maybe (AnnBoolExp b v)
_saWhere = Maybe (AnnBoolExp b v)
whereArg,
$sel:_saOrderBy:SelectArgs :: Maybe (NonEmpty (AnnotatedOrderByItemG b v))
_saOrderBy = Maybe (NonEmpty (AnnotatedOrderByItemG b v))
orderByArg,
$sel:_saLimit:SelectArgs :: Maybe Int
_saLimit = Maybe Int
limitArg,
$sel:_saOffset:SelectArgs :: Maybe Int64
_saOffset = Maybe Int64
offsetArg,
$sel:_saDistinct:SelectArgs :: Maybe (NonEmpty (Column b))
_saDistinct = Maybe (NonEmpty (Column b))
forall a. Maybe a
Nothing
}
InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
-> m (InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector)))
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
-> m (InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))))
-> InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
-> m (InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector)))
forall a b. (a -> b) -> a -> b
$
Maybe (AnnBoolExp 'DataConnector (UnpreparedValue 'DataConnector))
-> Maybe
(NonEmpty
(AnnotatedOrderByItemG
'DataConnector (UnpreparedValue 'DataConnector)))
-> Maybe Int
-> Maybe Int64
-> SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector)
forall (b :: BackendType) v.
Maybe (AnnBoolExp b v)
-> Maybe (NonEmpty (AnnotatedOrderByItemG b v))
-> Maybe Int
-> Maybe Int64
-> SelectArgsG b v
mkSelectArgs
(Maybe (AnnBoolExp 'DataConnector (UnpreparedValue 'DataConnector))
-> Maybe
(NonEmpty
(AnnotatedOrderByItemG
'DataConnector (UnpreparedValue 'DataConnector)))
-> Maybe Int
-> Maybe Int64
-> SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
-> InputFieldsParser
n
(Maybe
(AnnBoolExp 'DataConnector (UnpreparedValue 'DataConnector)))
-> InputFieldsParser
MetadataObjId
n
(Maybe
(NonEmpty
(AnnotatedOrderByItemG
'DataConnector (UnpreparedValue 'DataConnector)))
-> Maybe Int
-> Maybe Int64
-> SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InputFieldsParser
n
(Maybe
(AnnBoolExp 'DataConnector (UnpreparedValue 'DataConnector)))
whereParser
InputFieldsParser
MetadataObjId
n
(Maybe
(NonEmpty
(AnnotatedOrderByItemG
'DataConnector (UnpreparedValue 'DataConnector)))
-> Maybe Int
-> Maybe Int64
-> SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
-> InputFieldsParser
n
(Maybe
(NonEmpty
(AnnotatedOrderByItemG
'DataConnector (UnpreparedValue 'DataConnector))))
-> InputFieldsParser
MetadataObjId
n
(Maybe Int
-> Maybe Int64
-> SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> InputFieldsParser
n
(Maybe
(NonEmpty
(AnnotatedOrderByItemG
'DataConnector (UnpreparedValue 'DataConnector))))
orderByParser
InputFieldsParser
MetadataObjId
n
(Maybe Int
-> Maybe Int64
-> SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
-> InputFieldsParser MetadataObjId n (Maybe Int)
-> InputFieldsParser
MetadataObjId
n
(Maybe Int64
-> SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> InputFieldsParser MetadataObjId n (Maybe Int)
forall (n :: * -> *).
MonadParse n =>
InputFieldsParser n (Maybe Int)
GS.S.tableLimitArg
InputFieldsParser
MetadataObjId
n
(Maybe Int64
-> SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
-> InputFieldsParser MetadataObjId n (Maybe Int64)
-> InputFieldsParser
n (SelectArgsG 'DataConnector (UnpreparedValue 'DataConnector))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> InputFieldsParser MetadataObjId n (Maybe Int64)
forall (n :: * -> *).
MonadParse n =>
InputFieldsParser n (Maybe Int64)
GS.S.tableOffsetArg
countTypeInput' ::
MonadParse n =>
Maybe (P.Parser 'P.Both n IR.C.Name) ->
P.InputFieldsParser n (IR.CountDistinct -> IR.A.CountAggregate)
countTypeInput' :: Maybe (Parser 'Both n Name)
-> InputFieldsParser n (CountDistinct -> CountAggregate)
countTypeInput' = \case
Just Parser 'Both n Name
columnEnum -> Maybe Name -> CountDistinct -> CountAggregate
mkCountAggregate (Maybe Name -> CountDistinct -> CountAggregate)
-> InputFieldsParser MetadataObjId n (Maybe Name)
-> InputFieldsParser n (CountDistinct -> CountAggregate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name
-> Maybe Description
-> Parser 'Both n Name
-> InputFieldsParser MetadataObjId n (Maybe Name)
forall (m :: * -> *) (k :: Kind) origin a.
(MonadParse m, 'Input <: k) =>
Name
-> Maybe Description
-> Parser origin k m a
-> InputFieldsParser origin m (Maybe a)
P.fieldOptional Name
Name._column Maybe Description
forall a. Maybe a
Nothing Parser 'Both n Name
columnEnum
Maybe (Parser 'Both n Name)
Nothing -> (CountDistinct -> CountAggregate)
-> InputFieldsParser n (CountDistinct -> CountAggregate)
forall (f :: * -> *) a. Applicative f => a -> f a
pure ((CountDistinct -> CountAggregate)
-> InputFieldsParser n (CountDistinct -> CountAggregate))
-> (CountDistinct -> CountAggregate)
-> InputFieldsParser n (CountDistinct -> CountAggregate)
forall a b. (a -> b) -> a -> b
$ Maybe Name -> CountDistinct -> CountAggregate
mkCountAggregate Maybe Name
forall a. Maybe a
Nothing
where
mkCountAggregate :: Maybe IR.C.Name -> IR.CountDistinct -> IR.A.CountAggregate
mkCountAggregate :: Maybe Name -> CountDistinct -> CountAggregate
mkCountAggregate Maybe Name
Nothing CountDistinct
_ = CountAggregate
IR.A.StarCount
mkCountAggregate (Just Name
column) CountDistinct
IR.SelectCountDistinct = Name -> CountAggregate
IR.A.ColumnDistinctCount Name
column
mkCountAggregate (Just Name
column) CountDistinct
IR.SelectCountNonDistinct = Name -> CountAggregate
IR.A.ColumnCount Name
column