{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE TemplateHaskell #-}
module Hasura.GraphQL.Schema.BoolExp
( AggregationPredicatesSchema (..),
tableBoolExp,
logicalModelBoolExp,
mkBoolOperator,
equalityOperators,
comparisonOperators,
)
where
import Data.Has (getter)
import Data.Text.Casing (GQLNameIdentifier)
import Data.Text.Casing qualified as C
import Data.Text.Extended
import Hasura.Base.Error (throw500)
import Hasura.Function.Cache
import Hasura.GraphQL.Parser.Class
import Hasura.GraphQL.Schema.Backend
import Hasura.GraphQL.Schema.Common
import Hasura.GraphQL.Schema.Parser
( InputFieldsParser,
Kind (..),
Parser,
)
import Hasura.GraphQL.Schema.Parser qualified as P
import Hasura.GraphQL.Schema.Table
import Hasura.GraphQL.Schema.Typename
import Hasura.LogicalModel.Cache (LogicalModelInfo (..))
import Hasura.LogicalModel.Common
import Hasura.LogicalModel.Types (LogicalModelName (..))
import Hasura.Name qualified as Name
import Hasura.Prelude
import Hasura.RQL.IR.BoolExp
import Hasura.RQL.IR.Value
import Hasura.RQL.Types.Backend
import Hasura.RQL.Types.BackendType (BackendType)
import Hasura.RQL.Types.Column
import Hasura.RQL.Types.ComputedField
import Hasura.RQL.Types.NamingCase
import Hasura.RQL.Types.Relationships.Local
import Hasura.RQL.Types.Schema.Options qualified as Options
import Hasura.RQL.Types.SchemaCache hiding (askTableInfo)
import Hasura.RQL.Types.Source
import Hasura.RQL.Types.SourceCustomization
import Hasura.Table.Cache
import Language.GraphQL.Draft.Syntax qualified as G
import Type.Reflection
class AggregationPredicatesSchema (b :: BackendType) where
aggregationPredicatesParser ::
forall r m n.
(MonadBuildSourceSchema b r m n) =>
TableInfo b ->
SchemaT r m (Maybe (InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)]))
instance {-# OVERLAPPABLE #-} (AggregationPredicates b ~ Const Void) => AggregationPredicatesSchema (b :: BackendType) where
aggregationPredicatesParser ::
forall r m n.
(MonadBuildSourceSchema b r m n) =>
TableInfo b ->
SchemaT r m (Maybe (InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)]))
aggregationPredicatesParser :: forall r (m :: * -> *) (n :: * -> *).
MonadBuildSourceSchema b r m n =>
TableInfo b
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
aggregationPredicatesParser TableInfo b
_ = Maybe (InputFieldsParser n [Const Void (UnpreparedValue b)])
-> SchemaT
r m (Maybe (InputFieldsParser n [Const Void (UnpreparedValue b)]))
forall a. a -> SchemaT r m a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe (InputFieldsParser n [Const Void (UnpreparedValue b)])
forall a. Maybe a
Nothing
boolExpInternal ::
forall b r m n name.
( Typeable name,
Ord name,
ToTxt name,
MonadBuildSchema b r m n,
AggregationPredicatesSchema b
) =>
GQLNameIdentifier ->
[FieldInfo b] ->
G.Description ->
name ->
SchemaT r m (Maybe (InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)])) ->
SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
boolExpInternal :: forall (b :: BackendType) r (m :: * -> *) (n :: * -> *) name.
(Typeable name, Ord name, ToTxt name, MonadBuildSchema b r m n,
AggregationPredicatesSchema b) =>
GQLNameIdentifier
-> [FieldInfo b]
-> Description
-> name
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
boolExpInternal GQLNameIdentifier
gqlName [FieldInfo b]
fieldInfos Description
description name
memoizeKey SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
mkAggPredParser = do
SourceInfo b
sourceInfo :: SourceInfo b <- (r -> SourceInfo b) -> SchemaT r m (SourceInfo b)
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks r -> SourceInfo b
forall a t. Has a t => t -> a
getter
Name
-> (SourceName, name)
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall (m :: * -> *) a (p :: (* -> *) -> * -> *) (n :: * -> *) b.
(MonadMemoize m, Ord a, Typeable a, Typeable p, MonadParse n,
Typeable b) =>
Name -> a -> m (p n b) -> m (p n b)
P.memoizeOn 'boolExpInternal (SourceInfo b -> SourceName
forall (b :: BackendType). SourceInfo b -> SourceName
_siName SourceInfo b
sourceInfo, name
memoizeKey) do
let customization :: ResolvedSourceCustomization
customization = SourceInfo b -> ResolvedSourceCustomization
forall (b :: BackendType).
SourceInfo b -> ResolvedSourceCustomization
_siCustomization SourceInfo b
sourceInfo
tCase :: NamingCase
tCase = ResolvedSourceCustomization -> NamingCase
_rscNamingConvention ResolvedSourceCustomization
customization
mkTypename :: Name -> Name
mkTypename = MkTypename -> Name -> Name
runMkTypename (MkTypename -> Name -> Name) -> MkTypename -> Name -> Name
forall a b. (a -> b) -> a -> b
$ ResolvedSourceCustomization -> MkTypename
_rscTypeNames ResolvedSourceCustomization
customization
name :: Name
name = Name -> Name
mkTypename (Name -> Name) -> Name -> Name
forall a b. (a -> b) -> a -> b
$ NamingCase -> GQLNameIdentifier -> Name
applyTypeNameCaseIdentifier NamingCase
tCase (GQLNameIdentifier -> Name) -> GQLNameIdentifier -> Name
forall a b. (a -> b) -> a -> b
$ GQLNameIdentifier -> GQLNameIdentifier
mkTableBoolExpTypeName GQLNameIdentifier
gqlName
[InputFieldsParser n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))]
tableFieldParsers <- [Maybe
(InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b))))]
-> [InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))]
forall a. [Maybe a] -> [a]
forall (f :: * -> *) a. Filterable f => f (Maybe a) -> f a
catMaybes ([Maybe
(InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b))))]
-> [InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))])
-> SchemaT
r
m
[Maybe
(InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b))))]
-> SchemaT
r
m
[InputFieldsParser n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (FieldInfo b
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b))))))
-> [FieldInfo b]
-> SchemaT
r
m
[Maybe
(InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b))))]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse FieldInfo b
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))))
mkField [FieldInfo b]
fieldInfos
InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)]
aggregationPredicatesParser' <- InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)]
-> Maybe
(InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)])
-> InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]
forall a. a -> Maybe a -> a
fromMaybe ([AggregationPredicates b (UnpreparedValue b)]
-> InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]
forall a. a -> InputFieldsParser MetadataObjId n a
forall (f :: * -> *) a. Applicative f => a -> f a
pure []) (Maybe
(InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)])
-> InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)])
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
-> SchemaT
r
m
(InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
mkAggPredParser
Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
recur <- GQLNameIdentifier
-> [FieldInfo b]
-> Description
-> name
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *) name.
(Typeable name, Ord name, ToTxt name, MonadBuildSchema b r m n,
AggregationPredicatesSchema b) =>
GQLNameIdentifier
-> [FieldInfo b]
-> Description
-> name
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
boolExpInternal GQLNameIdentifier
gqlName [FieldInfo b]
fieldInfos Description
description name
memoizeKey SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
mkAggPredParser
let connectiveFieldParsers :: [InputFieldsParser
MetadataObjId n (Maybe (AnnBoolExp b (UnpreparedValue b)))]
connectiveFieldParsers =
[ Name
-> Maybe Description
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
-> InputFieldsParser
MetadataObjId n (Maybe (AnnBoolExp b (UnpreparedValue b)))
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.__or Maybe Description
forall a. Maybe a
Nothing ([AnnBoolExp b (UnpreparedValue b)]
-> AnnBoolExp b (UnpreparedValue b)
forall (backend :: BackendType) field.
[GBoolExp backend field] -> GBoolExp backend field
BoolOr ([AnnBoolExp b (UnpreparedValue b)]
-> AnnBoolExp b (UnpreparedValue b))
-> Parser MetadataObjId 'Input n [AnnBoolExp b (UnpreparedValue b)]
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
-> Parser MetadataObjId 'Input n [AnnBoolExp b (UnpreparedValue b)]
forall origin (k :: Kind) (m :: * -> *) a.
(MonadParse m, 'Input <: k) =>
Parser origin k m a -> Parser origin k m [a]
P.list Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
recur),
Name
-> Maybe Description
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
-> InputFieldsParser
MetadataObjId n (Maybe (AnnBoolExp b (UnpreparedValue b)))
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.__and Maybe Description
forall a. Maybe a
Nothing ([AnnBoolExp b (UnpreparedValue b)]
-> AnnBoolExp b (UnpreparedValue b)
forall (backend :: BackendType) field.
[GBoolExp backend field] -> GBoolExp backend field
BoolAnd ([AnnBoolExp b (UnpreparedValue b)]
-> AnnBoolExp b (UnpreparedValue b))
-> Parser MetadataObjId 'Input n [AnnBoolExp b (UnpreparedValue b)]
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
-> Parser MetadataObjId 'Input n [AnnBoolExp b (UnpreparedValue b)]
forall origin (k :: Kind) (m :: * -> *) a.
(MonadParse m, 'Input <: k) =>
Parser origin k m a -> Parser origin k m [a]
P.list Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
recur),
Name
-> Maybe Description
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
-> InputFieldsParser
MetadataObjId n (Maybe (AnnBoolExp b (UnpreparedValue b)))
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.__not Maybe Description
forall a. Maybe a
Nothing (AnnBoolExp b (UnpreparedValue b)
-> AnnBoolExp b (UnpreparedValue b)
forall (backend :: BackendType) field.
GBoolExp backend field -> GBoolExp backend field
BoolNot (AnnBoolExp b (UnpreparedValue b)
-> AnnBoolExp b (UnpreparedValue b))
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
recur)
]
pure
$ [AnnBoolExp b (UnpreparedValue b)]
-> AnnBoolExp b (UnpreparedValue b)
forall (backend :: BackendType) field.
[GBoolExp backend field] -> GBoolExp backend field
BoolAnd
([AnnBoolExp b (UnpreparedValue b)]
-> AnnBoolExp b (UnpreparedValue b))
-> Parser MetadataObjId 'Input n [AnnBoolExp b (UnpreparedValue b)]
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Name
-> Maybe Description
-> InputFieldsParser
MetadataObjId n [AnnBoolExp b (UnpreparedValue b)]
-> Parser MetadataObjId 'Input n [AnnBoolExp b (UnpreparedValue b)]
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
description) do
[AnnBoolExp b (UnpreparedValue b)]
tableFields <- (AnnBoolExpFld b (UnpreparedValue b)
-> AnnBoolExp b (UnpreparedValue b))
-> [AnnBoolExpFld b (UnpreparedValue b)]
-> [AnnBoolExp b (UnpreparedValue b)]
forall a b. (a -> b) -> [a] -> [b]
map AnnBoolExpFld b (UnpreparedValue b)
-> AnnBoolExp b (UnpreparedValue b)
forall (backend :: BackendType) field.
field -> GBoolExp backend field
BoolField ([AnnBoolExpFld b (UnpreparedValue b)]
-> [AnnBoolExp b (UnpreparedValue b)])
-> ([Maybe (AnnBoolExpFld b (UnpreparedValue b))]
-> [AnnBoolExpFld b (UnpreparedValue b)])
-> [Maybe (AnnBoolExpFld b (UnpreparedValue b))]
-> [AnnBoolExp b (UnpreparedValue b)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Maybe (AnnBoolExpFld b (UnpreparedValue b))]
-> [AnnBoolExpFld b (UnpreparedValue b)]
forall a. [Maybe a] -> [a]
forall (f :: * -> *) a. Filterable f => f (Maybe a) -> f a
catMaybes ([Maybe (AnnBoolExpFld b (UnpreparedValue b))]
-> [AnnBoolExp b (UnpreparedValue b)])
-> InputFieldsParser
MetadataObjId n [Maybe (AnnBoolExpFld b (UnpreparedValue b))]
-> InputFieldsParser
MetadataObjId n [AnnBoolExp b (UnpreparedValue b)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [InputFieldsParser n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))]
-> InputFieldsParser
MetadataObjId n [Maybe (AnnBoolExpFld b (UnpreparedValue b))]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
forall (f :: * -> *) a. Applicative f => [f a] -> f [a]
sequenceA [InputFieldsParser n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))]
tableFieldParsers
[AnnBoolExp b (UnpreparedValue b)]
specialFields <- [Maybe (AnnBoolExp b (UnpreparedValue b))]
-> [AnnBoolExp b (UnpreparedValue b)]
forall a. [Maybe a] -> [a]
forall (f :: * -> *) a. Filterable f => f (Maybe a) -> f a
catMaybes ([Maybe (AnnBoolExp b (UnpreparedValue b))]
-> [AnnBoolExp b (UnpreparedValue b)])
-> InputFieldsParser
MetadataObjId n [Maybe (AnnBoolExp b (UnpreparedValue b))]
-> InputFieldsParser
MetadataObjId n [AnnBoolExp b (UnpreparedValue b)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [InputFieldsParser
MetadataObjId n (Maybe (AnnBoolExp b (UnpreparedValue b)))]
-> InputFieldsParser
MetadataObjId n [Maybe (AnnBoolExp b (UnpreparedValue b))]
forall (t :: * -> *) (f :: * -> *) a.
(Traversable t, Applicative f) =>
t (f a) -> f (t a)
forall (f :: * -> *) a. Applicative f => [f a] -> f [a]
sequenceA [InputFieldsParser
MetadataObjId n (Maybe (AnnBoolExp b (UnpreparedValue b)))]
connectiveFieldParsers
[AnnBoolExp b (UnpreparedValue b)]
aggregationPredicateFields <- (AggregationPredicates b (UnpreparedValue b)
-> AnnBoolExp b (UnpreparedValue b))
-> [AggregationPredicates b (UnpreparedValue b)]
-> [AnnBoolExp b (UnpreparedValue b)]
forall a b. (a -> b) -> [a] -> [b]
map (AnnBoolExpFld b (UnpreparedValue b)
-> AnnBoolExp b (UnpreparedValue b)
forall (backend :: BackendType) field.
field -> GBoolExp backend field
BoolField (AnnBoolExpFld b (UnpreparedValue b)
-> AnnBoolExp b (UnpreparedValue b))
-> (AggregationPredicates b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b))
-> AggregationPredicates b (UnpreparedValue b)
-> AnnBoolExp b (UnpreparedValue b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AggregationPredicates b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b)
forall (backend :: BackendType) leaf.
AggregationPredicates backend leaf -> AnnBoolExpFld backend leaf
AVAggregationPredicates) ([AggregationPredicates b (UnpreparedValue b)]
-> [AnnBoolExp b (UnpreparedValue b)])
-> InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]
-> InputFieldsParser
MetadataObjId n [AnnBoolExp b (UnpreparedValue b)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)]
aggregationPredicatesParser'
pure ([AnnBoolExp b (UnpreparedValue b)]
tableFields [AnnBoolExp b (UnpreparedValue b)]
-> [AnnBoolExp b (UnpreparedValue b)]
-> [AnnBoolExp b (UnpreparedValue b)]
forall a. [a] -> [a] -> [a]
++ [AnnBoolExp b (UnpreparedValue b)]
specialFields [AnnBoolExp b (UnpreparedValue b)]
-> [AnnBoolExp b (UnpreparedValue b)]
-> [AnnBoolExp b (UnpreparedValue b)]
forall a. [a] -> [a] -> [a]
++ [AnnBoolExp b (UnpreparedValue b)]
aggregationPredicateFields)
where
mkField ::
FieldInfo b ->
SchemaT r m (Maybe (InputFieldsParser n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))))
mkField :: FieldInfo b
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))))
mkField FieldInfo b
fieldInfo = MaybeT
(SchemaT r m)
(InputFieldsParser n (Maybe (AnnBoolExpFld b (UnpreparedValue b))))
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))))
forall (m :: * -> *) a. MaybeT m a -> m (Maybe a)
runMaybeT do
!RoleName
roleName <- (SchemaContext -> RoleName) -> MaybeT (SchemaT r m) RoleName
forall r (m :: * -> *) a b.
(MonadReader r m, Has a r) =>
(a -> b) -> m b
retrieve SchemaContext -> RoleName
scRole
Name
fieldName <- Maybe Name -> MaybeT (SchemaT r m) Name
forall (m :: * -> *) b. Applicative m => Maybe b -> MaybeT m b
hoistMaybe (Maybe Name -> MaybeT (SchemaT r m) Name)
-> Maybe Name -> MaybeT (SchemaT r m) Name
forall a b. (a -> b) -> a -> b
$ FieldInfo b -> Maybe Name
forall (b :: BackendType). FieldInfo b -> Maybe Name
fieldInfoGraphQLName FieldInfo b
fieldInfo
Name
-> Maybe Description
-> Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b))
-> InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b)))
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
fieldName Maybe Description
forall a. Maybe a
Nothing (Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b))
-> InputFieldsParser
n (Maybe (AnnBoolExpFld b (UnpreparedValue b))))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(InputFieldsParser n (Maybe (AnnBoolExpFld b (UnpreparedValue b))))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> case FieldInfo b
fieldInfo of
FIColumn (SCIScalarColumn ColumnInfo b
columnInfo) ->
SchemaT
r
m
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall (m :: * -> *) a. Monad m => m a -> MaybeT m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (SchemaT
r
m
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b))))
-> SchemaT
r
m
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ ([OpExpG b (UnpreparedValue b)]
-> AnnBoolExpFld b (UnpreparedValue b))
-> Parser MetadataObjId 'Input n [OpExpG b (UnpreparedValue b)]
-> Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b))
forall a b.
(a -> b)
-> Parser MetadataObjId 'Input n a
-> Parser MetadataObjId 'Input n b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ColumnInfo b
-> [OpExpG b (UnpreparedValue b)]
-> AnnBoolExpFld b (UnpreparedValue b)
forall (backend :: BackendType) leaf.
ColumnInfo backend
-> [OpExpG backend leaf] -> AnnBoolExpFld backend leaf
AVColumn ColumnInfo b
columnInfo) (Parser MetadataObjId 'Input n [OpExpG b (UnpreparedValue b)]
-> Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
-> SchemaT
r m (Parser MetadataObjId 'Input n [OpExpG b (UnpreparedValue b)])
-> SchemaT
r
m
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(BackendSchema b, MonadBuildSchema b r m n) =>
ColumnType b -> SchemaT r m (Parser 'Input n [ComparisonExp b])
comparisonExps @b (ColumnInfo b -> ColumnType b
forall (b :: BackendType). ColumnInfo b -> ColumnType b
ciType ColumnInfo b
columnInfo)
FIColumn (SCIObjectColumn NestedObjectInfo b
_) -> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall a. MaybeT (SchemaT r m) a
forall (f :: * -> *) a. Alternative f => f a
empty
FIColumn (SCIArrayColumn NestedArrayInfo b
_) -> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall a. MaybeT (SchemaT r m) a
forall (f :: * -> *) a. Alternative f => f a
empty
FIRelationship RelInfo b
relationshipInfo -> do
case RelInfo b -> RelTarget b
forall (b :: BackendType). RelInfo b -> RelTarget b
riTarget RelInfo b
relationshipInfo of
RelTargetNativeQuery NativeQueryName
_ -> [Char]
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall a. HasCallStack => [Char] -> a
error [Char]
"mkField RelTargetNativeQuery"
RelTargetTable TableName b
remoteTable -> do
TableInfo b
remoteTableInfo <- TableName b -> MaybeT (SchemaT r m) (TableInfo b)
forall (b :: BackendType) r (m :: * -> *).
(Backend b, MonadError QErr m, MonadReader r m,
Has (SourceInfo b) r) =>
TableName b -> m (TableInfo b)
askTableInfo (TableName b -> MaybeT (SchemaT r m) (TableInfo b))
-> TableName b -> MaybeT (SchemaT r m) (TableInfo b)
forall a b. (a -> b) -> a -> b
$ TableName b
remoteTable
let remoteTablePermissions :: AnnBoolExp b (UnpreparedValue b)
remoteTablePermissions =
((AnnBoolExpFld b (PartialSQLExp b)
-> AnnBoolExpFld b (UnpreparedValue b))
-> GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
-> AnnBoolExp b (UnpreparedValue b)
forall a b. (a -> b) -> GBoolExp b a -> GBoolExp b b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((AnnBoolExpFld b (PartialSQLExp b)
-> AnnBoolExpFld b (UnpreparedValue b))
-> GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
-> AnnBoolExp b (UnpreparedValue b))
-> ((PartialSQLExp b -> UnpreparedValue b)
-> AnnBoolExpFld b (PartialSQLExp b)
-> AnnBoolExpFld b (UnpreparedValue b))
-> (PartialSQLExp b -> UnpreparedValue b)
-> GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
-> AnnBoolExp b (UnpreparedValue b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PartialSQLExp b -> UnpreparedValue b)
-> AnnBoolExpFld b (PartialSQLExp b)
-> AnnBoolExpFld b (UnpreparedValue b)
forall a b. (a -> b) -> AnnBoolExpFld b a -> AnnBoolExpFld b b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap) (PartialSQLExp b -> UnpreparedValue b
forall (b :: BackendType). PartialSQLExp b -> UnpreparedValue b
partialSQLExpToUnpreparedValue)
(GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
-> AnnBoolExp b (UnpreparedValue b))
-> GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
-> AnnBoolExp b (UnpreparedValue b)
forall a b. (a -> b) -> a -> b
$ GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
-> (SelPermInfo b
-> GBoolExp b (AnnBoolExpFld b (PartialSQLExp b)))
-> Maybe (SelPermInfo b)
-> GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
forall b a. b -> (a -> b) -> Maybe a -> b
maybe GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
forall (backend :: BackendType) scalar. AnnBoolExp backend scalar
annBoolExpTrue SelPermInfo b -> GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
forall (b :: BackendType). SelPermInfo b -> AnnBoolExpPartialSQL b
spiFilter
(Maybe (SelPermInfo b)
-> GBoolExp b (AnnBoolExpFld b (PartialSQLExp b)))
-> Maybe (SelPermInfo b)
-> GBoolExp b (AnnBoolExpFld b (PartialSQLExp b))
forall a b. (a -> b) -> a -> b
$ RoleName -> TableInfo b -> Maybe (SelPermInfo b)
forall (b :: BackendType).
RoleName -> TableInfo b -> Maybe (SelPermInfo b)
tableSelectPermissions RoleName
roleName TableInfo b
remoteTableInfo
Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
remoteBoolExp <- SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m) (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall (m :: * -> *) a. Monad m => m a -> MaybeT m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m) (Parser 'Input n (AnnBoolExp b (UnpreparedValue b))))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m) (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ TableInfo b
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(MonadBuildSchema b r m n, AggregationPredicatesSchema b) =>
TableInfo b
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
tableBoolExp TableInfo b
remoteTableInfo
pure $ (AnnBoolExp b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b))
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
-> Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b))
forall a b.
(a -> b)
-> Parser MetadataObjId 'Input n a
-> Parser MetadataObjId 'Input n b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (RelInfo b
-> RelationshipFilters b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b)
forall (backend :: BackendType) leaf.
RelInfo backend
-> RelationshipFilters backend leaf -> AnnBoolExpFld backend leaf
AVRelationship RelInfo b
relationshipInfo (RelationshipFilters b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b))
-> (AnnBoolExp b (UnpreparedValue b)
-> RelationshipFilters b (UnpreparedValue b))
-> AnnBoolExp b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. AnnBoolExp b (UnpreparedValue b)
-> AnnBoolExp b (UnpreparedValue b)
-> RelationshipFilters b (UnpreparedValue b)
forall (backend :: BackendType) leaf.
AnnBoolExp backend leaf
-> AnnBoolExp backend leaf -> RelationshipFilters backend leaf
RelationshipFilters AnnBoolExp b (UnpreparedValue b)
remoteTablePermissions) Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
remoteBoolExp
FIComputedField ComputedFieldInfo {Maybe Text
ComputedFieldName
ComputedFieldReturn b
XComputedField b
ComputedFieldFunction b
_cfiXComputedFieldInfo :: XComputedField b
_cfiName :: ComputedFieldName
_cfiFunction :: ComputedFieldFunction b
_cfiReturnType :: ComputedFieldReturn b
_cfiDescription :: Maybe Text
_cfiXComputedFieldInfo :: forall (b :: BackendType). ComputedFieldInfo b -> XComputedField b
_cfiName :: forall (b :: BackendType). ComputedFieldInfo b -> ComputedFieldName
_cfiFunction :: forall (b :: BackendType).
ComputedFieldInfo b -> ComputedFieldFunction b
_cfiReturnType :: forall (b :: BackendType).
ComputedFieldInfo b -> ComputedFieldReturn b
_cfiDescription :: forall (b :: BackendType). ComputedFieldInfo b -> Maybe Text
..} -> do
let ComputedFieldFunction {Maybe PGDescription
Seq (FunctionArgument b)
FunctionName b
ComputedFieldImplicitArguments b
_cffName :: FunctionName b
_cffInputArgs :: Seq (FunctionArgument b)
_cffComputedFieldImplicitArgs :: ComputedFieldImplicitArguments b
_cffDescription :: Maybe PGDescription
_cffName :: forall (b :: BackendType).
ComputedFieldFunction b -> FunctionName b
_cffInputArgs :: forall (b :: BackendType).
ComputedFieldFunction b -> Seq (FunctionArgument b)
_cffComputedFieldImplicitArgs :: forall (b :: BackendType).
ComputedFieldFunction b -> ComputedFieldImplicitArguments b
_cffDescription :: forall (b :: BackendType).
ComputedFieldFunction b -> Maybe PGDescription
..} = ComputedFieldFunction b
_cfiFunction
case Seq (FunctionArgument b) -> [FunctionArgument b]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList Seq (FunctionArgument b)
_cffInputArgs of
[] -> do
let functionArgs :: FunctionArgsExpG (FunctionArgumentExp b (UnpreparedValue b))
functionArgs =
([FunctionArgumentExp b (UnpreparedValue b)]
-> HashMap Text (FunctionArgumentExp b (UnpreparedValue b))
-> FunctionArgsExpG (FunctionArgumentExp b (UnpreparedValue b)))
-> HashMap Text (FunctionArgumentExp b (UnpreparedValue b))
-> [FunctionArgumentExp b (UnpreparedValue b)]
-> FunctionArgsExpG (FunctionArgumentExp b (UnpreparedValue b))
forall a b c. (a -> b -> c) -> b -> a -> c
flip [FunctionArgumentExp b (UnpreparedValue b)]
-> HashMap Text (FunctionArgumentExp b (UnpreparedValue b))
-> FunctionArgsExpG (FunctionArgumentExp b (UnpreparedValue b))
forall a. [a] -> HashMap Text a -> FunctionArgsExpG a
FunctionArgsExp HashMap Text (FunctionArgumentExp b (UnpreparedValue b))
forall a. Monoid a => a
mempty
([FunctionArgumentExp b (UnpreparedValue b)]
-> FunctionArgsExpG (FunctionArgumentExp b (UnpreparedValue b)))
-> [FunctionArgumentExp b (UnpreparedValue b)]
-> FunctionArgsExpG (FunctionArgumentExp b (UnpreparedValue b))
forall a b. (a -> b) -> a -> b
$ forall (b :: BackendType) v.
Backend b =>
v -> ComputedFieldImplicitArguments b -> [FunctionArgumentExp b v]
fromComputedFieldImplicitArguments @b UnpreparedValue b
forall (b :: BackendType). UnpreparedValue b
UVSession ComputedFieldImplicitArguments b
_cffComputedFieldImplicitArgs
(ComputedFieldBoolExp b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b))
-> Parser
MetadataObjId 'Input n (ComputedFieldBoolExp b (UnpreparedValue b))
-> Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b))
forall a b.
(a -> b)
-> Parser MetadataObjId 'Input n a
-> Parser MetadataObjId 'Input n b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (AnnComputedFieldBoolExp b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b)
forall (backend :: BackendType) leaf.
AnnComputedFieldBoolExp backend leaf -> AnnBoolExpFld backend leaf
AVComputedField (AnnComputedFieldBoolExp b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b))
-> (ComputedFieldBoolExp b (UnpreparedValue b)
-> AnnComputedFieldBoolExp b (UnpreparedValue b))
-> ComputedFieldBoolExp b (UnpreparedValue b)
-> AnnBoolExpFld b (UnpreparedValue b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XComputedField b
-> ComputedFieldName
-> FunctionName b
-> FunctionArgsExpG (FunctionArgumentExp b (UnpreparedValue b))
-> ComputedFieldBoolExp b (UnpreparedValue b)
-> AnnComputedFieldBoolExp b (UnpreparedValue b)
forall (backend :: BackendType) scalar.
XComputedField backend
-> ComputedFieldName
-> FunctionName backend
-> FunctionArgsExp backend scalar
-> ComputedFieldBoolExp backend scalar
-> AnnComputedFieldBoolExp backend scalar
AnnComputedFieldBoolExp XComputedField b
_cfiXComputedFieldInfo ComputedFieldName
_cfiName FunctionName b
_cffName FunctionArgsExpG (FunctionArgumentExp b (UnpreparedValue b))
functionArgs)
(Parser
MetadataObjId 'Input n (ComputedFieldBoolExp b (UnpreparedValue b))
-> Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> case forall (b :: BackendType).
Backend b =>
ComputedFieldReturn b -> ComputedFieldReturnType b
computedFieldReturnType @b ComputedFieldReturn b
_cfiReturnType of
ReturnsScalar ScalarType b
scalarType -> SchemaT
r
m
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
forall (m :: * -> *) a. Monad m => m a -> MaybeT m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (SchemaT
r
m
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b))))
-> SchemaT
r
m
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ ([OpExpG b (UnpreparedValue b)]
-> ComputedFieldBoolExp b (UnpreparedValue b))
-> Parser MetadataObjId 'Input n [OpExpG b (UnpreparedValue b)]
-> Parser
MetadataObjId 'Input n (ComputedFieldBoolExp b (UnpreparedValue b))
forall a b.
(a -> b)
-> Parser MetadataObjId 'Input n a
-> Parser MetadataObjId 'Input n b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap [OpExpG b (UnpreparedValue b)]
-> ComputedFieldBoolExp b (UnpreparedValue b)
forall (backend :: BackendType) scalar.
[OpExpG backend scalar] -> ComputedFieldBoolExp backend scalar
CFBEScalar (Parser MetadataObjId 'Input n [OpExpG b (UnpreparedValue b)]
-> Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> SchemaT
r m (Parser MetadataObjId 'Input n [OpExpG b (UnpreparedValue b)])
-> SchemaT
r
m
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(BackendSchema b, MonadBuildSchema b r m n) =>
ColumnType b -> SchemaT r m (Parser 'Input n [ComparisonExp b])
comparisonExps @b (ScalarType b -> ColumnType b
forall (b :: BackendType). ScalarType b -> ColumnType b
ColumnScalar ScalarType b
scalarType)
ReturnsTable TableName b
table -> do
TableInfo b
info <- TableName b -> MaybeT (SchemaT r m) (TableInfo b)
forall (b :: BackendType) r (m :: * -> *).
(Backend b, MonadError QErr m, MonadReader r m,
Has (SourceInfo b) r) =>
TableName b -> m (TableInfo b)
askTableInfo TableName b
table
SchemaT
r
m
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
forall (m :: * -> *) a. Monad m => m a -> MaybeT m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (SchemaT
r
m
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b))))
-> SchemaT
r
m
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ (AnnBoolExp b (UnpreparedValue b)
-> ComputedFieldBoolExp b (UnpreparedValue b))
-> Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
-> Parser
MetadataObjId 'Input n (ComputedFieldBoolExp b (UnpreparedValue b))
forall a b.
(a -> b)
-> Parser MetadataObjId 'Input n a
-> Parser MetadataObjId 'Input n b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (TableName b
-> AnnBoolExp b (UnpreparedValue b)
-> ComputedFieldBoolExp b (UnpreparedValue b)
forall (backend :: BackendType) scalar.
TableName backend
-> AnnBoolExp backend scalar -> ComputedFieldBoolExp backend scalar
CFBETable TableName b
table) (Parser 'Input n (AnnBoolExp b (UnpreparedValue b))
-> Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
-> SchemaT
r
m
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TableInfo b
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(MonadBuildSchema b r m n, AggregationPredicatesSchema b) =>
TableInfo b
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
tableBoolExp TableInfo b
info
ComputedFieldReturnType b
ReturnsOthers -> Maybe
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
forall (m :: * -> *) b. Applicative m => Maybe b -> MaybeT m b
hoistMaybe Maybe
(Parser
MetadataObjId
'Input
n
(ComputedFieldBoolExp b (UnpreparedValue b)))
forall a. Maybe a
Nothing
[FunctionArgument b]
_ -> Maybe
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
-> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall (m :: * -> *) b. Applicative m => Maybe b -> MaybeT m b
hoistMaybe Maybe
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall a. Maybe a
Nothing
FIRemoteRelationship RemoteFieldInfo (DBJoinField b)
_ -> MaybeT
(SchemaT r m)
(Parser
MetadataObjId 'Input n (AnnBoolExpFld b (UnpreparedValue b)))
forall a. MaybeT (SchemaT r m) a
forall (f :: * -> *) a. Alternative f => f a
empty
logicalModelBoolExp ::
forall b r m n.
( MonadBuildSchema b r m n,
AggregationPredicatesSchema b
) =>
LogicalModelInfo b ->
SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
logicalModelBoolExp :: forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(MonadBuildSchema b r m n, AggregationPredicatesSchema b) =>
LogicalModelInfo b
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
logicalModelBoolExp LogicalModelInfo b
logicalModel =
case InsOrdHashMap (Column b) (NullableScalarType b)
-> Maybe [FieldInfo b]
forall (b :: BackendType).
Backend b =>
InsOrdHashMap (Column b) (NullableScalarType b)
-> Maybe [FieldInfo b]
toFieldInfo (InsOrdHashMap (Column b) (LogicalModelField b)
-> InsOrdHashMap (Column b) (NullableScalarType b)
forall k (b :: BackendType).
InsOrdHashMap k (LogicalModelField b)
-> InsOrdHashMap k (NullableScalarType b)
columnsFromFields (InsOrdHashMap (Column b) (LogicalModelField b)
-> InsOrdHashMap (Column b) (NullableScalarType b))
-> InsOrdHashMap (Column b) (LogicalModelField b)
-> InsOrdHashMap (Column b) (NullableScalarType b)
forall a b. (a -> b) -> a -> b
$ LogicalModelInfo b
-> InsOrdHashMap (Column b) (LogicalModelField b)
forall (b :: BackendType).
LogicalModelInfo b
-> InsOrdHashMap (Column b) (LogicalModelField b)
_lmiFields LogicalModelInfo b
logicalModel) of
Maybe [FieldInfo b]
Nothing -> Text
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall (m :: * -> *) a. QErrM m => Text -> m a
throw500 (Text
-> SchemaT
r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b))))
-> Text
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ Text
"Error creating fields for logical model " Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> LogicalModelName -> Text
forall a. Show a => a -> Text
tshow (LogicalModelInfo b -> LogicalModelName
forall (b :: BackendType). LogicalModelInfo b -> LogicalModelName
_lmiName LogicalModelInfo b
logicalModel)
Just [FieldInfo b]
fieldInfo -> do
let name :: Name
name = LogicalModelName -> Name
getLogicalModelName (LogicalModelInfo b -> LogicalModelName
forall (b :: BackendType). LogicalModelInfo b -> LogicalModelName
_lmiName LogicalModelInfo b
logicalModel)
gqlName :: GQLNameIdentifier
gqlName = GQLNameIdentifier -> GQLNameIdentifier
mkTableBoolExpTypeName (Name -> GQLNameIdentifier
C.fromCustomName Name
name)
mkAggPredParser :: SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
mkAggPredParser = Maybe
(InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)])
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
forall a. a -> SchemaT r m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)]
-> Maybe
(InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)])
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
pure InputFieldsParser n [AggregationPredicates b (UnpreparedValue b)]
forall a. Monoid a => a
mempty)
memoizeKey :: Name
memoizeKey = Name
name
description :: Description
description =
Text -> Description
G.Description
(Text -> Description) -> Text -> Description
forall a b. (a -> b) -> a -> b
$ Text
"Boolean expression to filter rows from the logical model for "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Name
name
Name -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
". All fields are combined with a logical 'AND'."
in GQLNameIdentifier
-> [FieldInfo b]
-> Description
-> Name
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *) name.
(Typeable name, Ord name, ToTxt name, MonadBuildSchema b r m n,
AggregationPredicatesSchema b) =>
GQLNameIdentifier
-> [FieldInfo b]
-> Description
-> name
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
boolExpInternal GQLNameIdentifier
gqlName [FieldInfo b]
fieldInfo Description
description Name
memoizeKey SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
mkAggPredParser
tableBoolExp ::
forall b r m n.
(MonadBuildSchema b r m n, AggregationPredicatesSchema b) =>
TableInfo b ->
SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
tableBoolExp :: forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(MonadBuildSchema b r m n, AggregationPredicatesSchema b) =>
TableInfo b
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
tableBoolExp TableInfo b
tableInfo = do
GQLNameIdentifier
gqlName <- TableInfo b -> SchemaT r m GQLNameIdentifier
forall (b :: BackendType) (m :: * -> *).
(Backend b, MonadError QErr m) =>
TableInfo b -> m GQLNameIdentifier
getTableIdentifierName TableInfo b
tableInfo
[FieldInfo b]
fieldInfos <- TableInfo b -> SchemaT r m [FieldInfo b]
forall (b :: BackendType) r (m :: * -> *).
(Backend b, MonadError QErr m, MonadReader r m,
Has SchemaContext r, Has (SourceInfo b) r) =>
TableInfo b -> m [FieldInfo b]
tableSelectFields TableInfo b
tableInfo
let mkAggPredParser :: SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
mkAggPredParser = TableInfo b
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
forall r (m :: * -> *) (n :: * -> *).
MonadBuildSourceSchema b r m n =>
TableInfo b
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *).
(AggregationPredicatesSchema b, MonadBuildSourceSchema b r m n) =>
TableInfo b
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
aggregationPredicatesParser TableInfo b
tableInfo
let description :: Description
description =
Text -> Description
G.Description
(Text -> Description) -> Text -> Description
forall a b. (a -> b) -> a -> b
$ Text
"Boolean expression to filter rows from the table "
Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> TableInfo b -> TableName b
forall (b :: BackendType). TableInfo b -> TableName b
tableInfoName TableInfo b
tableInfo
TableName b -> Text -> Text
forall t. ToTxt t => t -> Text -> Text
<<> Text
". All fields are combined with a logical 'AND'."
let memoizeKey :: TableName b
memoizeKey = TableInfo b -> TableName b
forall (b :: BackendType). TableInfo b -> TableName b
tableInfoName TableInfo b
tableInfo
GQLNameIdentifier
-> [FieldInfo b]
-> Description
-> TableName b
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
forall (b :: BackendType) r (m :: * -> *) (n :: * -> *) name.
(Typeable name, Ord name, ToTxt name, MonadBuildSchema b r m n,
AggregationPredicatesSchema b) =>
GQLNameIdentifier
-> [FieldInfo b]
-> Description
-> name
-> SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
-> SchemaT r m (Parser 'Input n (AnnBoolExp b (UnpreparedValue b)))
boolExpInternal GQLNameIdentifier
gqlName [FieldInfo b]
fieldInfos Description
description TableName b
memoizeKey SchemaT
r
m
(Maybe
(InputFieldsParser
n [AggregationPredicates b (UnpreparedValue b)]))
mkAggPredParser
mkBoolOperator ::
(MonadParse n, 'Input P.<: k) =>
NamingCase ->
Options.DangerouslyCollapseBooleans ->
GQLNameIdentifier ->
Maybe G.Description ->
Parser k n a ->
InputFieldsParser n (Maybe a)
mkBoolOperator :: forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
Options.DangerouslyCollapseBooleans GQLNameIdentifier
name Maybe Description
desc = (Maybe (Maybe a) -> Maybe a)
-> InputFieldsParser MetadataObjId n (Maybe (Maybe a))
-> InputFieldsParser MetadataObjId n (Maybe a)
forall a b.
(a -> b)
-> InputFieldsParser MetadataObjId n a
-> InputFieldsParser MetadataObjId n b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Maybe (Maybe a) -> Maybe a
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join (InputFieldsParser MetadataObjId n (Maybe (Maybe a))
-> InputFieldsParser MetadataObjId n (Maybe a))
-> (Parser k n a
-> InputFieldsParser MetadataObjId n (Maybe (Maybe a)))
-> Parser k n a
-> InputFieldsParser MetadataObjId n (Maybe a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Name
-> Maybe Description
-> Parser MetadataObjId k n (Maybe a)
-> InputFieldsParser MetadataObjId n (Maybe (Maybe a))
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 (NamingCase -> GQLNameIdentifier -> Name
applyFieldNameCaseIdentifier NamingCase
tCase GQLNameIdentifier
name) Maybe Description
desc (Parser MetadataObjId k n (Maybe a)
-> InputFieldsParser MetadataObjId n (Maybe (Maybe a)))
-> (Parser k n a -> Parser MetadataObjId k n (Maybe a))
-> Parser k n a
-> InputFieldsParser MetadataObjId n (Maybe (Maybe a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Parser k n a -> Parser MetadataObjId k n (Maybe a)
forall origin (k :: Kind) (m :: * -> *) a.
(MonadParse m, 'Input <: k) =>
Parser origin k m a -> Parser origin k m (Maybe a)
P.nullable
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
Options.Don'tDangerouslyCollapseBooleans GQLNameIdentifier
name Maybe Description
desc = Name
-> Maybe Description
-> Parser k n a
-> InputFieldsParser MetadataObjId n (Maybe a)
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 (NamingCase -> GQLNameIdentifier -> Name
applyFieldNameCaseIdentifier NamingCase
tCase GQLNameIdentifier
name) Maybe Description
desc
equalityOperators ::
(MonadParse n, 'Input P.<: k) =>
NamingCase ->
Options.DangerouslyCollapseBooleans ->
Parser k n (UnpreparedValue b) ->
Parser k n (UnpreparedValue b) ->
[InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))]
equalityOperators :: 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)))]
equalityOperators NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull Parser k n (UnpreparedValue b)
valueParser Parser k n (UnpreparedValue b)
valueListParser =
[ NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser 'Both n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull ((Name, [NameSuffix]) -> GQLNameIdentifier
C.fromAutogeneratedTuple $$(G.litGQLIdentifier ["_is", "null"])) Maybe Description
forall a. Maybe a
Nothing (Parser 'Both n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b))))
-> Parser 'Both n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ OpExpG b (UnpreparedValue b)
-> OpExpG b (UnpreparedValue b)
-> Bool
-> OpExpG b (UnpreparedValue b)
forall a. a -> a -> Bool -> a
bool OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field. OpExpG backend field
ANISNOTNULL OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field. OpExpG backend field
ANISNULL (Bool -> OpExpG b (UnpreparedValue b))
-> Parser MetadataObjId 'Both n Bool
-> Parser 'Both n (OpExpG b (UnpreparedValue b))
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,
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull (Name -> GQLNameIdentifier
C.fromAutogeneratedName Name
Name.__eq) Maybe Description
forall a. Maybe a
Nothing (Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b))))
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ ComparisonNullability
-> UnpreparedValue b -> OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field.
ComparisonNullability -> field -> OpExpG backend field
AEQ ComparisonNullability
NonNullableComparison (UnpreparedValue b -> OpExpG b (UnpreparedValue b))
-> Parser k n (UnpreparedValue b)
-> Parser k n (OpExpG b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser k n (UnpreparedValue b)
valueParser,
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull (Name -> GQLNameIdentifier
C.fromAutogeneratedName Name
Name.__neq) Maybe Description
forall a. Maybe a
Nothing (Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b))))
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ ComparisonNullability
-> UnpreparedValue b -> OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field.
ComparisonNullability -> field -> OpExpG backend field
ANE ComparisonNullability
NonNullableComparison (UnpreparedValue b -> OpExpG b (UnpreparedValue b))
-> Parser k n (UnpreparedValue b)
-> Parser k n (OpExpG b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser k n (UnpreparedValue b)
valueParser,
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull (Name -> GQLNameIdentifier
C.fromAutogeneratedName Name
Name.__in) Maybe Description
forall a. Maybe a
Nothing (Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b))))
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ UnpreparedValue b -> OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field.
field -> OpExpG backend field
AIN (UnpreparedValue b -> OpExpG b (UnpreparedValue b))
-> Parser k n (UnpreparedValue b)
-> Parser k n (OpExpG b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser k n (UnpreparedValue b)
valueListParser,
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull (Name -> GQLNameIdentifier
C.fromAutogeneratedName Name
Name.__nin) Maybe Description
forall a. Maybe a
Nothing (Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b))))
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ UnpreparedValue b -> OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field.
field -> OpExpG backend field
ANIN (UnpreparedValue b -> OpExpG b (UnpreparedValue b))
-> Parser k n (UnpreparedValue b)
-> Parser k n (OpExpG b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser k n (UnpreparedValue b)
valueListParser
]
comparisonOperators ::
(MonadParse n, 'Input P.<: k) =>
NamingCase ->
Options.DangerouslyCollapseBooleans ->
Parser k n (UnpreparedValue b) ->
[InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))]
comparisonOperators :: forall (n :: * -> *) (k :: Kind) (b :: BackendType).
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> Parser k n (UnpreparedValue b)
-> [InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))]
comparisonOperators NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull Parser k n (UnpreparedValue b)
valueParser =
[ NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull (Name -> GQLNameIdentifier
C.fromAutogeneratedName Name
Name.__gt) Maybe Description
forall a. Maybe a
Nothing (Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b))))
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ UnpreparedValue b -> OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field.
field -> OpExpG backend field
AGT (UnpreparedValue b -> OpExpG b (UnpreparedValue b))
-> Parser k n (UnpreparedValue b)
-> Parser k n (OpExpG b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser k n (UnpreparedValue b)
valueParser,
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull (Name -> GQLNameIdentifier
C.fromAutogeneratedName Name
Name.__lt) Maybe Description
forall a. Maybe a
Nothing (Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b))))
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ UnpreparedValue b -> OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field.
field -> OpExpG backend field
ALT (UnpreparedValue b -> OpExpG b (UnpreparedValue b))
-> Parser k n (UnpreparedValue b)
-> Parser k n (OpExpG b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser k n (UnpreparedValue b)
valueParser,
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull (Name -> GQLNameIdentifier
C.fromAutogeneratedName Name
Name.__gte) Maybe Description
forall a. Maybe a
Nothing (Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b))))
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ UnpreparedValue b -> OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field.
field -> OpExpG backend field
AGTE (UnpreparedValue b -> OpExpG b (UnpreparedValue b))
-> Parser k n (UnpreparedValue b)
-> Parser k n (OpExpG b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser k n (UnpreparedValue b)
valueParser,
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall (n :: * -> *) (k :: Kind) a.
(MonadParse n, 'Input <: k) =>
NamingCase
-> DangerouslyCollapseBooleans
-> GQLNameIdentifier
-> Maybe Description
-> Parser k n a
-> InputFieldsParser n (Maybe a)
mkBoolOperator NamingCase
tCase DangerouslyCollapseBooleans
collapseIfNull (Name -> GQLNameIdentifier
C.fromAutogeneratedName Name
Name.__lte) Maybe Description
forall a. Maybe a
Nothing (Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b))))
-> Parser k n (OpExpG b (UnpreparedValue b))
-> InputFieldsParser n (Maybe (OpExpG b (UnpreparedValue b)))
forall a b. (a -> b) -> a -> b
$ UnpreparedValue b -> OpExpG b (UnpreparedValue b)
forall (backend :: BackendType) field.
field -> OpExpG backend field
ALTE (UnpreparedValue b -> OpExpG b (UnpreparedValue b))
-> Parser k n (UnpreparedValue b)
-> Parser k n (OpExpG b (UnpreparedValue b))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser k n (UnpreparedValue b)
valueParser
]