{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE UndecidableInstances #-}

-- | This modules defines the tree of Select types: how we represent a query internally, from its top
--   level 'QueryDB' down to each individual field. Most of those types have three type arguments:
--
--   b: BackendType
--     The backend that is targeted by that specific select (Postgres Vanilla, MSSQL...); we use the
--     type families in the Backend class to decide how different parts of the IR are represented in
--     different backends.
--
--   v: Type
--     The type of the leaf values in our AST; used almost exclusively for column values, over which
--     queries can be parameterized. The output of the parser phase will use @UnpreparedValue b@ for
--     the leaves, and most backends will then transform the AST to interpret those values and
--     consequently change @v@ to be @SQLExpression b@
--
--   r: BackendType -> Type
--     Joins across backends mean that the aforementioned @b@ parameter won't be the same throughout
--     the entire tree; at some point we will have an 'AnyBackend' used to encapsulate a branch that
--     uses a different @b@. We still want, however, to be able to parameterize the values of the
--     leaves in that separate branch, and that's what the @r@ parameter is for. We also use
--     'UnpreparedValue' here during the parsing phase, meaning all leaf values will be
--     @UnpreparedValue b@ for their respective backend @b@, and most backends will then transform
--     their AST, cutting all such remote branches, and therefore using @Const Void@ for @r@.
module Hasura.RQL.IR.Select
  ( AggregateField (..),
    AggregateFields,
    AggregateOp (..),
    AnnAggregateSelect,
    AnnAggregateSelectG,
    AnnColumnField (..),
    AnnField,
    AnnFieldG (..),
    AnnFields,
    AnnFieldsG,
    AnnNestedObjectSelectG (..),
    AnnNestedObjectSelect,
    AnnNestedArraySelectG (..),
    AnnNestedArraySelect,
    AnnObjectSelect,
    AnnObjectSelectG (..),
    AnnSimpleSelect,
    AnnSimpleSelectG,
    AnnSimpleStreamSelect,
    AnnSimpleStreamSelectG,
    ArrayAggregateSelect,
    ArrayAggregateSelectG,
    ArrayConnectionSelect,
    ArrayRelationSelectG,
    ArraySelect,
    ArraySelectFieldsG,
    ArraySelectG (..),
    SelectionField (..),
    SelectionFields,
    ComputedFieldScalarSelect (..),
    ComputedFieldSelect (..),
    ConnectionField (..),
    ConnectionFields,
    ConnectionSelect (..),
    ConnectionSlice (..),
    ConnectionSplit (..),
    ConnectionSplitKind (..),
    EdgeField (..),
    EdgeFields,
    ObjectRelationSelect,
    ObjectRelationSelectG,
    PageInfoField (..),
    PageInfoFields,
    QueryDB (..),
    RemoteSourceSelect (..),
    RemoteRelationshipSelect (..),
    SourceRelationshipSelection (..),
    TableAggregateField,
    TableAggregateFieldG (..),
    TableAggregateFields,
    TableAggregateFieldsG,
    GroupByG (..),
    GroupByField (..),
    GroupKeyField (..),
    CountDistinct (..),
    insertFunctionArg,
    mkAnnColumnField,
    mkAnnColumnFieldAsText,
    traverseSourceRelationshipSelection,
    module Hasura.RQL.IR.Select.AnnSelectG,
    module Hasura.RQL.IR.Select.Args,
    module Hasura.RQL.IR.Select.From,
    module Hasura.RQL.IR.Select.OrderBy,
    module Hasura.RQL.IR.Select.TablePerm,
    module Hasura.RQL.IR.Select.RelationSelect,
  )
where

import Data.Bifoldable
import Data.HashMap.Strict qualified as HashMap
import Data.Kind (Type)
import Data.List.NonEmpty qualified as NE
import Data.Sequence qualified as Seq
import Hasura.Function.Cache
import Hasura.Prelude
import Hasura.RQL.IR.BoolExp
import Hasura.RQL.IR.OrderBy
import Hasura.RQL.IR.Select.AnnSelectG
import Hasura.RQL.IR.Select.Args
import Hasura.RQL.IR.Select.From
import Hasura.RQL.IR.Select.OrderBy
import Hasura.RQL.IR.Select.RelationSelect
import Hasura.RQL.IR.Select.TablePerm
import Hasura.RQL.Types.Backend
import Hasura.RQL.Types.BackendType
import Hasura.RQL.Types.Column
import Hasura.RQL.Types.Common
import Hasura.RQL.Types.ComputedField
import Hasura.RQL.Types.Instances ()
import Hasura.RQL.Types.Relationships.Remote
import Hasura.RQL.Types.Schema.Options (StringifyNumbers)

-- Root selection

data QueryDB (b :: BackendType) (r :: Type) v
  = QDBMultipleRows (AnnSimpleSelectG b r v)
  | QDBSingleRow (AnnSimpleSelectG b r v)
  | QDBAggregation (AnnAggregateSelectG b r v)
  | QDBConnection (ConnectionSelect b r v)
  | QDBStreamMultipleRows (AnnSimpleStreamSelectG b r v)
  deriving stock ((forall x. QueryDB b r v -> Rep (QueryDB b r v) x)
-> (forall x. Rep (QueryDB b r v) x -> QueryDB b r v)
-> Generic (QueryDB b r v)
forall x. Rep (QueryDB b r v) x -> QueryDB b r v
forall x. QueryDB b r v -> Rep (QueryDB b r v) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (b :: BackendType) r v x.
Rep (QueryDB b r v) x -> QueryDB b r v
forall (b :: BackendType) r v x.
QueryDB b r v -> Rep (QueryDB b r v) x
$cfrom :: forall (b :: BackendType) r v x.
QueryDB b r v -> Rep (QueryDB b r v) x
from :: forall x. QueryDB b r v -> Rep (QueryDB b r v) x
$cto :: forall (b :: BackendType) r v x.
Rep (QueryDB b r v) x -> QueryDB b r v
to :: forall x. Rep (QueryDB b r v) x -> QueryDB b r v
Generic, (forall a b. (a -> b) -> QueryDB b r a -> QueryDB b r b)
-> (forall a b. a -> QueryDB b r b -> QueryDB b r a)
-> Functor (QueryDB b r)
forall a b. a -> QueryDB b r b -> QueryDB b r a
forall a b. (a -> b) -> QueryDB b r a -> QueryDB b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> QueryDB b r b -> QueryDB b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> QueryDB b r a -> QueryDB b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> QueryDB b r a -> QueryDB b r b
fmap :: forall a b. (a -> b) -> QueryDB b r a -> QueryDB b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> QueryDB b r b -> QueryDB b r a
<$ :: forall a b. a -> QueryDB b r b -> QueryDB b r a
Functor, (forall m. Monoid m => QueryDB b r m -> m)
-> (forall m a. Monoid m => (a -> m) -> QueryDB b r a -> m)
-> (forall m a. Monoid m => (a -> m) -> QueryDB b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> QueryDB b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> QueryDB b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> QueryDB b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> QueryDB b r a -> b)
-> (forall a. (a -> a -> a) -> QueryDB b r a -> a)
-> (forall a. (a -> a -> a) -> QueryDB b r a -> a)
-> (forall a. QueryDB b r a -> [a])
-> (forall a. QueryDB b r a -> Bool)
-> (forall a. QueryDB b r a -> Int)
-> (forall a. Eq a => a -> QueryDB b r a -> Bool)
-> (forall a. Ord a => QueryDB b r a -> a)
-> (forall a. Ord a => QueryDB b r a -> a)
-> (forall a. Num a => QueryDB b r a -> a)
-> (forall a. Num a => QueryDB b r a -> a)
-> Foldable (QueryDB b r)
forall a. Eq a => a -> QueryDB b r a -> Bool
forall a. Num a => QueryDB b r a -> a
forall a. Ord a => QueryDB b r a -> a
forall m. Monoid m => QueryDB b r m -> m
forall a. QueryDB b r a -> Bool
forall a. QueryDB b r a -> Int
forall a. QueryDB b r a -> [a]
forall a. (a -> a -> a) -> QueryDB b r a -> a
forall m a. Monoid m => (a -> m) -> QueryDB b r a -> m
forall b a. (b -> a -> b) -> b -> QueryDB b r a -> b
forall a b. (a -> b -> b) -> b -> QueryDB b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> QueryDB b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
QueryDB b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
QueryDB b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
QueryDB b r m -> m
forall (b :: BackendType) r a. Backend b => QueryDB b r a -> Bool
forall (b :: BackendType) r a. Backend b => QueryDB b r a -> Int
forall (b :: BackendType) r a. Backend b => QueryDB b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> QueryDB b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> QueryDB b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> QueryDB b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> QueryDB b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
QueryDB b r m -> m
fold :: forall m. Monoid m => QueryDB b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> QueryDB b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> QueryDB b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> QueryDB b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> QueryDB b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> QueryDB b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> QueryDB b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> QueryDB b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> QueryDB b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> QueryDB b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> QueryDB b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> QueryDB b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> QueryDB b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> QueryDB b r a -> a
foldr1 :: forall a. (a -> a -> a) -> QueryDB b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> QueryDB b r a -> a
foldl1 :: forall a. (a -> a -> a) -> QueryDB b r a -> a
$ctoList :: forall (b :: BackendType) r a. Backend b => QueryDB b r a -> [a]
toList :: forall a. QueryDB b r a -> [a]
$cnull :: forall (b :: BackendType) r a. Backend b => QueryDB b r a -> Bool
null :: forall a. QueryDB b r a -> Bool
$clength :: forall (b :: BackendType) r a. Backend b => QueryDB b r a -> Int
length :: forall a. QueryDB b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> QueryDB b r a -> Bool
elem :: forall a. Eq a => a -> QueryDB b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
QueryDB b r a -> a
maximum :: forall a. Ord a => QueryDB b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
QueryDB b r a -> a
minimum :: forall a. Ord a => QueryDB b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
QueryDB b r a -> a
sum :: forall a. Num a => QueryDB b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
QueryDB b r a -> a
product :: forall a. Num a => QueryDB b r a -> a
Foldable, Functor (QueryDB b r)
Foldable (QueryDB b r)
Functor (QueryDB b r)
-> Foldable (QueryDB b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> QueryDB b r a -> f (QueryDB b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    QueryDB b r (f a) -> f (QueryDB b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> QueryDB b r a -> m (QueryDB b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    QueryDB b r (m a) -> m (QueryDB b r a))
-> Traversable (QueryDB b r)
forall (b :: BackendType) r. Backend b => Functor (QueryDB b r)
forall (b :: BackendType) r. Backend b => Foldable (QueryDB b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
QueryDB b r (m a) -> m (QueryDB b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
QueryDB b r (f a) -> f (QueryDB b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> QueryDB b r a -> m (QueryDB b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> QueryDB b r a -> f (QueryDB b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
QueryDB b r (m a) -> m (QueryDB b r a)
forall (f :: * -> *) a.
Applicative f =>
QueryDB b r (f a) -> f (QueryDB b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> QueryDB b r a -> m (QueryDB b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> QueryDB b r a -> f (QueryDB b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> QueryDB b r a -> f (QueryDB b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> QueryDB b r a -> f (QueryDB b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
QueryDB b r (f a) -> f (QueryDB b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
QueryDB b r (f a) -> f (QueryDB b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> QueryDB b r a -> m (QueryDB b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> QueryDB b r a -> m (QueryDB b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
QueryDB b r (m a) -> m (QueryDB b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
QueryDB b r (m a) -> m (QueryDB b r a)
Traversable)

instance (Backend b) => Bifoldable (QueryDB b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> QueryDB b a b -> m
bifoldMap a -> m
f b -> m
g = \case
    QDBMultipleRows AnnSimpleSelectG b a b
annSel -> (a -> m) -> (b -> m) -> AnnSimpleSelectG b a b -> m
forall (b :: BackendType) (f :: BackendType -> * -> * -> *) m r v.
(Backend b, Bifoldable (f b), Monoid m) =>
(r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG a -> m
f b -> m
g AnnSimpleSelectG b a b
annSel
    QDBSingleRow AnnSimpleSelectG b a b
annSel -> (a -> m) -> (b -> m) -> AnnSimpleSelectG b a b -> m
forall (b :: BackendType) (f :: BackendType -> * -> * -> *) m r v.
(Backend b, Bifoldable (f b), Monoid m) =>
(r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG a -> m
f b -> m
g AnnSimpleSelectG b a b
annSel
    QDBAggregation AnnAggregateSelectG b a b
annSel -> (a -> m) -> (b -> m) -> AnnAggregateSelectG b a b -> m
forall (b :: BackendType) (f :: BackendType -> * -> * -> *) m r v.
(Backend b, Bifoldable (f b), Monoid m) =>
(r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG a -> m
f b -> m
g AnnAggregateSelectG b a b
annSel
    QDBConnection ConnectionSelect b a b
connSel -> (a -> m) -> (b -> m) -> ConnectionSelect b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> ConnectionSelect b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g ConnectionSelect b a b
connSel
    QDBStreamMultipleRows AnnSimpleStreamSelectG b a b
annSel -> (a -> m) -> (b -> m) -> AnnSimpleStreamSelectG b a b -> m
forall (b :: BackendType) (f :: BackendType -> * -> * -> *) m r v.
(Backend b, Bifoldable (f b), Monoid m) =>
(r -> m) -> (v -> m) -> AnnSelectStreamG b (f b r) v -> m
bifoldMapAnnSelectStreamG a -> m
f b -> m
g AnnSimpleStreamSelectG b a b
annSel

-- Select

type AnnSimpleSelectG b r v = AnnSelectG b (AnnFieldG b r) v

type AnnAggregateSelectG b r v = AnnSelectG b (TableAggregateFieldG b r) v

type AnnSimpleStreamSelectG b r v = AnnSelectStreamG b (AnnFieldG b r) v

type AnnSimpleSelect b = AnnSimpleSelectG b Void (SQLExpression b)

type AnnAggregateSelect b = AnnAggregateSelectG b Void (SQLExpression b)

type AnnSimpleStreamSelect b = AnnSimpleStreamSelectG b Void (SQLExpression b)

-- Relay select

data ConnectionSelect (b :: BackendType) (r :: Type) v = ConnectionSelect
  { forall (b :: BackendType) r v. ConnectionSelect b r v -> XRelay b
_csXRelay :: XRelay b,
    forall (b :: BackendType) r v.
ConnectionSelect b r v -> PrimaryKeyColumns b
_csPrimaryKeyColumns :: PrimaryKeyColumns b,
    forall (b :: BackendType) r v.
ConnectionSelect b r v -> Maybe (NonEmpty (ConnectionSplit b v))
_csSplit :: Maybe (NE.NonEmpty (ConnectionSplit b v)),
    forall (b :: BackendType) r v.
ConnectionSelect b r v -> Maybe ConnectionSlice
_csSlice :: Maybe ConnectionSlice,
    forall (b :: BackendType) r v.
ConnectionSelect b r v -> AnnSelectG b (ConnectionField b r) v
_csSelect :: (AnnSelectG b (ConnectionField b r) v)
  }
  deriving stock ((forall a b.
 (a -> b) -> ConnectionSelect b r a -> ConnectionSelect b r b)
-> (forall a b.
    a -> ConnectionSelect b r b -> ConnectionSelect b r a)
-> Functor (ConnectionSelect b r)
forall a b. a -> ConnectionSelect b r b -> ConnectionSelect b r a
forall a b.
(a -> b) -> ConnectionSelect b r a -> ConnectionSelect b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> ConnectionSelect b r b -> ConnectionSelect b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ConnectionSelect b r a -> ConnectionSelect b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ConnectionSelect b r a -> ConnectionSelect b r b
fmap :: forall a b.
(a -> b) -> ConnectionSelect b r a -> ConnectionSelect b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> ConnectionSelect b r b -> ConnectionSelect b r a
<$ :: forall a b. a -> ConnectionSelect b r b -> ConnectionSelect b r a
Functor, (forall m. Monoid m => ConnectionSelect b r m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> ConnectionSelect b r a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> ConnectionSelect b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> ConnectionSelect b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> ConnectionSelect b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> ConnectionSelect b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> ConnectionSelect b r a -> b)
-> (forall a. (a -> a -> a) -> ConnectionSelect b r a -> a)
-> (forall a. (a -> a -> a) -> ConnectionSelect b r a -> a)
-> (forall a. ConnectionSelect b r a -> [a])
-> (forall a. ConnectionSelect b r a -> Bool)
-> (forall a. ConnectionSelect b r a -> Int)
-> (forall a. Eq a => a -> ConnectionSelect b r a -> Bool)
-> (forall a. Ord a => ConnectionSelect b r a -> a)
-> (forall a. Ord a => ConnectionSelect b r a -> a)
-> (forall a. Num a => ConnectionSelect b r a -> a)
-> (forall a. Num a => ConnectionSelect b r a -> a)
-> Foldable (ConnectionSelect b r)
forall a. Eq a => a -> ConnectionSelect b r a -> Bool
forall a. Num a => ConnectionSelect b r a -> a
forall a. Ord a => ConnectionSelect b r a -> a
forall m. Monoid m => ConnectionSelect b r m -> m
forall a. ConnectionSelect b r a -> Bool
forall a. ConnectionSelect b r a -> Int
forall a. ConnectionSelect b r a -> [a]
forall a. (a -> a -> a) -> ConnectionSelect b r a -> a
forall m a. Monoid m => (a -> m) -> ConnectionSelect b r a -> m
forall b a. (b -> a -> b) -> b -> ConnectionSelect b r a -> b
forall a b. (a -> b -> b) -> b -> ConnectionSelect b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ConnectionSelect b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionSelect b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionSelect b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ConnectionSelect b r m -> m
forall (b :: BackendType) r a.
Backend b =>
ConnectionSelect b r a -> Bool
forall (b :: BackendType) r a.
Backend b =>
ConnectionSelect b r a -> Int
forall (b :: BackendType) r a.
Backend b =>
ConnectionSelect b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionSelect b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionSelect b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionSelect b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionSelect b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ConnectionSelect b r m -> m
fold :: forall m. Monoid m => ConnectionSelect b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionSelect b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ConnectionSelect b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionSelect b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ConnectionSelect b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionSelect b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ConnectionSelect b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionSelect b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ConnectionSelect b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionSelect b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ConnectionSelect b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionSelect b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ConnectionSelect b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionSelect b r a -> a
foldr1 :: forall a. (a -> a -> a) -> ConnectionSelect b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionSelect b r a -> a
foldl1 :: forall a. (a -> a -> a) -> ConnectionSelect b r a -> a
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
ConnectionSelect b r a -> [a]
toList :: forall a. ConnectionSelect b r a -> [a]
$cnull :: forall (b :: BackendType) r a.
Backend b =>
ConnectionSelect b r a -> Bool
null :: forall a. ConnectionSelect b r a -> Bool
$clength :: forall (b :: BackendType) r a.
Backend b =>
ConnectionSelect b r a -> Int
length :: forall a. ConnectionSelect b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ConnectionSelect b r a -> Bool
elem :: forall a. Eq a => a -> ConnectionSelect b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionSelect b r a -> a
maximum :: forall a. Ord a => ConnectionSelect b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionSelect b r a -> a
minimum :: forall a. Ord a => ConnectionSelect b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionSelect b r a -> a
sum :: forall a. Num a => ConnectionSelect b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionSelect b r a -> a
product :: forall a. Num a => ConnectionSelect b r a -> a
Foldable, Functor (ConnectionSelect b r)
Foldable (ConnectionSelect b r)
Functor (ConnectionSelect b r)
-> Foldable (ConnectionSelect b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> ConnectionSelect b r a -> f (ConnectionSelect b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    ConnectionSelect b r (f a) -> f (ConnectionSelect b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> ConnectionSelect b r a -> m (ConnectionSelect b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    ConnectionSelect b r (m a) -> m (ConnectionSelect b r a))
-> Traversable (ConnectionSelect b r)
forall (b :: BackendType) r.
Backend b =>
Functor (ConnectionSelect b r)
forall (b :: BackendType) r.
Backend b =>
Foldable (ConnectionSelect b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ConnectionSelect b r (m a) -> m (ConnectionSelect b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ConnectionSelect b r (f a) -> f (ConnectionSelect b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ConnectionSelect b r a -> m (ConnectionSelect b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> ConnectionSelect b r a -> f (ConnectionSelect b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
ConnectionSelect b r (m a) -> m (ConnectionSelect b r a)
forall (f :: * -> *) a.
Applicative f =>
ConnectionSelect b r (f a) -> f (ConnectionSelect b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConnectionSelect b r a -> m (ConnectionSelect b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConnectionSelect b r a -> f (ConnectionSelect b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> ConnectionSelect b r a -> f (ConnectionSelect b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConnectionSelect b r a -> f (ConnectionSelect b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ConnectionSelect b r (f a) -> f (ConnectionSelect b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ConnectionSelect b r (f a) -> f (ConnectionSelect b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ConnectionSelect b r a -> m (ConnectionSelect b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConnectionSelect b r a -> m (ConnectionSelect b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ConnectionSelect b r (m a) -> m (ConnectionSelect b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ConnectionSelect b r (m a) -> m (ConnectionSelect b r a)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AnnSelectG b (ConnectionField b r) v),
    Eq (ConnectionSlice),
    Eq (ConnectionSplit b v),
    Eq (PrimaryKeyColumns b)
  ) =>
  Eq (ConnectionSelect b r v)

deriving stock instance
  ( Backend b,
    Show (AnnSelectG b (ConnectionField b r) v),
    Show (ConnectionSlice),
    Show (ConnectionSplit b v),
    Show (PrimaryKeyColumns b)
  ) =>
  Show (ConnectionSelect b r v)

instance (Backend b) => Bifoldable (ConnectionSelect b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> ConnectionSelect b a b -> m
bifoldMap a -> m
f b -> m
g ConnectionSelect {Maybe (NonEmpty (ConnectionSplit b b))
Maybe ConnectionSlice
PrimaryKeyColumns b
XRelay b
AnnSelectG b (ConnectionField b a) b
$sel:_csXRelay:ConnectionSelect :: forall (b :: BackendType) r v. ConnectionSelect b r v -> XRelay b
$sel:_csPrimaryKeyColumns:ConnectionSelect :: forall (b :: BackendType) r v.
ConnectionSelect b r v -> PrimaryKeyColumns b
$sel:_csSplit:ConnectionSelect :: forall (b :: BackendType) r v.
ConnectionSelect b r v -> Maybe (NonEmpty (ConnectionSplit b v))
$sel:_csSlice:ConnectionSelect :: forall (b :: BackendType) r v.
ConnectionSelect b r v -> Maybe ConnectionSlice
$sel:_csSelect:ConnectionSelect :: forall (b :: BackendType) r v.
ConnectionSelect b r v -> AnnSelectG b (ConnectionField b r) v
_csXRelay :: XRelay b
_csPrimaryKeyColumns :: PrimaryKeyColumns b
_csSplit :: Maybe (NonEmpty (ConnectionSplit b b))
_csSlice :: Maybe ConnectionSlice
_csSelect :: AnnSelectG b (ConnectionField b a) b
..} =
    (NonEmpty (ConnectionSplit b b) -> m)
-> Maybe (NonEmpty (ConnectionSplit b b)) -> m
forall m a. Monoid m => (a -> m) -> Maybe a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((ConnectionSplit b b -> m) -> NonEmpty (ConnectionSplit b b) -> m
forall m a. Monoid m => (a -> m) -> NonEmpty a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((ConnectionSplit b b -> m) -> NonEmpty (ConnectionSplit b b) -> m)
-> (ConnectionSplit b b -> m)
-> NonEmpty (ConnectionSplit b b)
-> m
forall a b. (a -> b) -> a -> b
$ (b -> m) -> ConnectionSplit b b -> m
forall m a. Monoid m => (a -> m) -> ConnectionSplit b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap b -> m
g) Maybe (NonEmpty (ConnectionSplit b b))
_csSplit
      m -> m -> m
forall a. Semigroup a => a -> a -> a
<> (a -> m) -> (b -> m) -> AnnSelectG b (ConnectionField b a) b -> m
forall (b :: BackendType) (f :: BackendType -> * -> * -> *) m r v.
(Backend b, Bifoldable (f b), Monoid m) =>
(r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG a -> m
f b -> m
g AnnSelectG b (ConnectionField b a) b
_csSelect

data ConnectionSplit (b :: BackendType) v = ConnectionSplit
  { forall (b :: BackendType) v.
ConnectionSplit b v -> ConnectionSplitKind
_csKind :: ConnectionSplitKind,
    forall (b :: BackendType) v. ConnectionSplit b v -> v
_csValue :: v,
    forall (b :: BackendType) v.
ConnectionSplit b v -> OrderByItemG b (AnnotatedOrderByElement b v)
_csOrderBy :: (OrderByItemG b (AnnotatedOrderByElement b v))
  }
  deriving stock ((forall a b.
 (a -> b) -> ConnectionSplit b a -> ConnectionSplit b b)
-> (forall a b. a -> ConnectionSplit b b -> ConnectionSplit b a)
-> Functor (ConnectionSplit b)
forall a b. a -> ConnectionSplit b b -> ConnectionSplit b a
forall a b. (a -> b) -> ConnectionSplit b a -> ConnectionSplit b b
forall (b :: BackendType) a b.
Backend b =>
a -> ConnectionSplit b b -> ConnectionSplit b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> ConnectionSplit b a -> ConnectionSplit b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> ConnectionSplit b a -> ConnectionSplit b b
fmap :: forall a b. (a -> b) -> ConnectionSplit b a -> ConnectionSplit b b
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> ConnectionSplit b b -> ConnectionSplit b a
<$ :: forall a b. a -> ConnectionSplit b b -> ConnectionSplit b a
Functor, (forall x. ConnectionSplit b v -> Rep (ConnectionSplit b v) x)
-> (forall x. Rep (ConnectionSplit b v) x -> ConnectionSplit b v)
-> Generic (ConnectionSplit b v)
forall x. Rep (ConnectionSplit b v) x -> ConnectionSplit b v
forall x. ConnectionSplit b v -> Rep (ConnectionSplit b v) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (b :: BackendType) v x.
Rep (ConnectionSplit b v) x -> ConnectionSplit b v
forall (b :: BackendType) v x.
ConnectionSplit b v -> Rep (ConnectionSplit b v) x
$cfrom :: forall (b :: BackendType) v x.
ConnectionSplit b v -> Rep (ConnectionSplit b v) x
from :: forall x. ConnectionSplit b v -> Rep (ConnectionSplit b v) x
$cto :: forall (b :: BackendType) v x.
Rep (ConnectionSplit b v) x -> ConnectionSplit b v
to :: forall x. Rep (ConnectionSplit b v) x -> ConnectionSplit b v
Generic, (forall m. Monoid m => ConnectionSplit b m -> m)
-> (forall m a. Monoid m => (a -> m) -> ConnectionSplit b a -> m)
-> (forall m a. Monoid m => (a -> m) -> ConnectionSplit b a -> m)
-> (forall a b. (a -> b -> b) -> b -> ConnectionSplit b a -> b)
-> (forall a b. (a -> b -> b) -> b -> ConnectionSplit b a -> b)
-> (forall b a. (b -> a -> b) -> b -> ConnectionSplit b a -> b)
-> (forall b a. (b -> a -> b) -> b -> ConnectionSplit b a -> b)
-> (forall a. (a -> a -> a) -> ConnectionSplit b a -> a)
-> (forall a. (a -> a -> a) -> ConnectionSplit b a -> a)
-> (forall a. ConnectionSplit b a -> [a])
-> (forall a. ConnectionSplit b a -> Bool)
-> (forall a. ConnectionSplit b a -> Int)
-> (forall a. Eq a => a -> ConnectionSplit b a -> Bool)
-> (forall a. Ord a => ConnectionSplit b a -> a)
-> (forall a. Ord a => ConnectionSplit b a -> a)
-> (forall a. Num a => ConnectionSplit b a -> a)
-> (forall a. Num a => ConnectionSplit b a -> a)
-> Foldable (ConnectionSplit b)
forall a. Eq a => a -> ConnectionSplit b a -> Bool
forall a. Num a => ConnectionSplit b a -> a
forall a. Ord a => ConnectionSplit b a -> a
forall m. Monoid m => ConnectionSplit b m -> m
forall a. ConnectionSplit b a -> Bool
forall a. ConnectionSplit b a -> Int
forall a. ConnectionSplit b a -> [a]
forall a. (a -> a -> a) -> ConnectionSplit b a -> a
forall m a. Monoid m => (a -> m) -> ConnectionSplit b a -> m
forall b a. (b -> a -> b) -> b -> ConnectionSplit b a -> b
forall a b. (a -> b -> b) -> b -> ConnectionSplit b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> ConnectionSplit b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
ConnectionSplit b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
ConnectionSplit b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
ConnectionSplit b m -> m
forall (b :: BackendType) a.
Backend b =>
ConnectionSplit b a -> Bool
forall (b :: BackendType) a.
Backend b =>
ConnectionSplit b a -> Int
forall (b :: BackendType) a.
Backend b =>
ConnectionSplit b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ConnectionSplit b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionSplit b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionSplit b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionSplit b a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
ConnectionSplit b m -> m
fold :: forall m. Monoid m => ConnectionSplit b m -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionSplit b a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ConnectionSplit b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionSplit b a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ConnectionSplit b a -> m
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionSplit b a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ConnectionSplit b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionSplit b a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ConnectionSplit b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionSplit b a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ConnectionSplit b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionSplit b a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ConnectionSplit b a -> b
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ConnectionSplit b a -> a
foldr1 :: forall a. (a -> a -> a) -> ConnectionSplit b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ConnectionSplit b a -> a
foldl1 :: forall a. (a -> a -> a) -> ConnectionSplit b a -> a
$ctoList :: forall (b :: BackendType) a.
Backend b =>
ConnectionSplit b a -> [a]
toList :: forall a. ConnectionSplit b a -> [a]
$cnull :: forall (b :: BackendType) a.
Backend b =>
ConnectionSplit b a -> Bool
null :: forall a. ConnectionSplit b a -> Bool
$clength :: forall (b :: BackendType) a.
Backend b =>
ConnectionSplit b a -> Int
length :: forall a. ConnectionSplit b a -> Int
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> ConnectionSplit b a -> Bool
elem :: forall a. Eq a => a -> ConnectionSplit b a -> Bool
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
ConnectionSplit b a -> a
maximum :: forall a. Ord a => ConnectionSplit b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
ConnectionSplit b a -> a
minimum :: forall a. Ord a => ConnectionSplit b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
ConnectionSplit b a -> a
sum :: forall a. Num a => ConnectionSplit b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
ConnectionSplit b a -> a
product :: forall a. Num a => ConnectionSplit b a -> a
Foldable, Functor (ConnectionSplit b)
Foldable (ConnectionSplit b)
Functor (ConnectionSplit b)
-> Foldable (ConnectionSplit b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> ConnectionSplit b a -> f (ConnectionSplit b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    ConnectionSplit b (f a) -> f (ConnectionSplit b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> ConnectionSplit b a -> m (ConnectionSplit b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    ConnectionSplit b (m a) -> m (ConnectionSplit b a))
-> Traversable (ConnectionSplit b)
forall (b :: BackendType). Backend b => Functor (ConnectionSplit b)
forall (b :: BackendType).
Backend b =>
Foldable (ConnectionSplit b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
ConnectionSplit b (m a) -> m (ConnectionSplit b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
ConnectionSplit b (f a) -> f (ConnectionSplit b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ConnectionSplit b a -> m (ConnectionSplit b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> ConnectionSplit b a -> f (ConnectionSplit b b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
ConnectionSplit b (m a) -> m (ConnectionSplit b a)
forall (f :: * -> *) a.
Applicative f =>
ConnectionSplit b (f a) -> f (ConnectionSplit b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConnectionSplit b a -> m (ConnectionSplit b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConnectionSplit b a -> f (ConnectionSplit b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> ConnectionSplit b a -> f (ConnectionSplit b b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConnectionSplit b a -> f (ConnectionSplit b b)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
ConnectionSplit b (f a) -> f (ConnectionSplit b a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ConnectionSplit b (f a) -> f (ConnectionSplit b a)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ConnectionSplit b a -> m (ConnectionSplit b b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConnectionSplit b a -> m (ConnectionSplit b b)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
ConnectionSplit b (m a) -> m (ConnectionSplit b a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ConnectionSplit b (m a) -> m (ConnectionSplit b a)
Traversable)

deriving stock instance
  ( Backend b,
    Eq v,
    Eq (OrderByItemG b (AnnotatedOrderByElement b v))
  ) =>
  Eq (ConnectionSplit b v)

deriving stock instance
  ( Backend b,
    Show v,
    Show (OrderByItemG b (AnnotatedOrderByElement b v))
  ) =>
  Show (ConnectionSplit b v)

instance
  ( Backend b,
    Hashable v,
    Hashable (OrderByItemG b (AnnotatedOrderByElement b v))
  ) =>
  Hashable (ConnectionSplit b v)

data ConnectionSlice
  = SliceFirst Int
  | SliceLast Int
  deriving stock (Int -> ConnectionSlice -> ShowS
[ConnectionSlice] -> ShowS
ConnectionSlice -> String
(Int -> ConnectionSlice -> ShowS)
-> (ConnectionSlice -> String)
-> ([ConnectionSlice] -> ShowS)
-> Show ConnectionSlice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConnectionSlice -> ShowS
showsPrec :: Int -> ConnectionSlice -> ShowS
$cshow :: ConnectionSlice -> String
show :: ConnectionSlice -> String
$cshowList :: [ConnectionSlice] -> ShowS
showList :: [ConnectionSlice] -> ShowS
Show, ConnectionSlice -> ConnectionSlice -> Bool
(ConnectionSlice -> ConnectionSlice -> Bool)
-> (ConnectionSlice -> ConnectionSlice -> Bool)
-> Eq ConnectionSlice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConnectionSlice -> ConnectionSlice -> Bool
== :: ConnectionSlice -> ConnectionSlice -> Bool
$c/= :: ConnectionSlice -> ConnectionSlice -> Bool
/= :: ConnectionSlice -> ConnectionSlice -> Bool
Eq, (forall x. ConnectionSlice -> Rep ConnectionSlice x)
-> (forall x. Rep ConnectionSlice x -> ConnectionSlice)
-> Generic ConnectionSlice
forall x. Rep ConnectionSlice x -> ConnectionSlice
forall x. ConnectionSlice -> Rep ConnectionSlice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ConnectionSlice -> Rep ConnectionSlice x
from :: forall x. ConnectionSlice -> Rep ConnectionSlice x
$cto :: forall x. Rep ConnectionSlice x -> ConnectionSlice
to :: forall x. Rep ConnectionSlice x -> ConnectionSlice
Generic)
  deriving anyclass (Eq ConnectionSlice
Eq ConnectionSlice
-> (Int -> ConnectionSlice -> Int)
-> (ConnectionSlice -> Int)
-> Hashable ConnectionSlice
Int -> ConnectionSlice -> Int
ConnectionSlice -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> ConnectionSlice -> Int
hashWithSalt :: Int -> ConnectionSlice -> Int
$chash :: ConnectionSlice -> Int
hash :: ConnectionSlice -> Int
Hashable)

data ConnectionSplitKind
  = CSKBefore
  | CSKAfter
  deriving stock (Int -> ConnectionSplitKind -> ShowS
[ConnectionSplitKind] -> ShowS
ConnectionSplitKind -> String
(Int -> ConnectionSplitKind -> ShowS)
-> (ConnectionSplitKind -> String)
-> ([ConnectionSplitKind] -> ShowS)
-> Show ConnectionSplitKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ConnectionSplitKind -> ShowS
showsPrec :: Int -> ConnectionSplitKind -> ShowS
$cshow :: ConnectionSplitKind -> String
show :: ConnectionSplitKind -> String
$cshowList :: [ConnectionSplitKind] -> ShowS
showList :: [ConnectionSplitKind] -> ShowS
Show, ConnectionSplitKind -> ConnectionSplitKind -> Bool
(ConnectionSplitKind -> ConnectionSplitKind -> Bool)
-> (ConnectionSplitKind -> ConnectionSplitKind -> Bool)
-> Eq ConnectionSplitKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ConnectionSplitKind -> ConnectionSplitKind -> Bool
== :: ConnectionSplitKind -> ConnectionSplitKind -> Bool
$c/= :: ConnectionSplitKind -> ConnectionSplitKind -> Bool
/= :: ConnectionSplitKind -> ConnectionSplitKind -> Bool
Eq, (forall x. ConnectionSplitKind -> Rep ConnectionSplitKind x)
-> (forall x. Rep ConnectionSplitKind x -> ConnectionSplitKind)
-> Generic ConnectionSplitKind
forall x. Rep ConnectionSplitKind x -> ConnectionSplitKind
forall x. ConnectionSplitKind -> Rep ConnectionSplitKind x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ConnectionSplitKind -> Rep ConnectionSplitKind x
from :: forall x. ConnectionSplitKind -> Rep ConnectionSplitKind x
$cto :: forall x. Rep ConnectionSplitKind x -> ConnectionSplitKind
to :: forall x. Rep ConnectionSplitKind x -> ConnectionSplitKind
Generic)
  deriving anyclass (Eq ConnectionSplitKind
Eq ConnectionSplitKind
-> (Int -> ConnectionSplitKind -> Int)
-> (ConnectionSplitKind -> Int)
-> Hashable ConnectionSplitKind
Int -> ConnectionSplitKind -> Int
ConnectionSplitKind -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> ConnectionSplitKind -> Int
hashWithSalt :: Int -> ConnectionSplitKind -> Int
$chash :: ConnectionSplitKind -> Int
hash :: ConnectionSplitKind -> Int
Hashable)

-- Fields

-- | captures a remote relationship's selection and the necessary context
data RemoteRelationshipSelect b r = RemoteRelationshipSelect
  { -- | The fields on the table that are required for the join condition
    -- of the remote relationship
    forall (b :: BackendType) r.
RemoteRelationshipSelect b r -> HashMap FieldName (DBJoinField b)
_rrsLHSJoinFields :: HashMap FieldName (DBJoinField b),
    -- | The field that captures the relationship
    -- r ~ (RemoteRelationshipField UnpreparedValue) when the AST is emitted by the parser.
    -- r ~ Void when an execution tree is constructed so that a backend is
    -- absolved of dealing with remote relationships.
    forall (b :: BackendType) r. RemoteRelationshipSelect b r -> r
_rrsRelationship :: r
  }
  deriving (RemoteRelationshipSelect b r
-> RemoteRelationshipSelect b r -> Bool
(RemoteRelationshipSelect b r
 -> RemoteRelationshipSelect b r -> Bool)
-> (RemoteRelationshipSelect b r
    -> RemoteRelationshipSelect b r -> Bool)
-> Eq (RemoteRelationshipSelect b r)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (b :: BackendType) r.
(Backend b, Eq r) =>
RemoteRelationshipSelect b r
-> RemoteRelationshipSelect b r -> Bool
$c== :: forall (b :: BackendType) r.
(Backend b, Eq r) =>
RemoteRelationshipSelect b r
-> RemoteRelationshipSelect b r -> Bool
== :: RemoteRelationshipSelect b r
-> RemoteRelationshipSelect b r -> Bool
$c/= :: forall (b :: BackendType) r.
(Backend b, Eq r) =>
RemoteRelationshipSelect b r
-> RemoteRelationshipSelect b r -> Bool
/= :: RemoteRelationshipSelect b r
-> RemoteRelationshipSelect b r -> Bool
Eq, Int -> RemoteRelationshipSelect b r -> ShowS
[RemoteRelationshipSelect b r] -> ShowS
RemoteRelationshipSelect b r -> String
(Int -> RemoteRelationshipSelect b r -> ShowS)
-> (RemoteRelationshipSelect b r -> String)
-> ([RemoteRelationshipSelect b r] -> ShowS)
-> Show (RemoteRelationshipSelect b r)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (b :: BackendType) r.
(Backend b, Show r) =>
Int -> RemoteRelationshipSelect b r -> ShowS
forall (b :: BackendType) r.
(Backend b, Show r) =>
[RemoteRelationshipSelect b r] -> ShowS
forall (b :: BackendType) r.
(Backend b, Show r) =>
RemoteRelationshipSelect b r -> String
$cshowsPrec :: forall (b :: BackendType) r.
(Backend b, Show r) =>
Int -> RemoteRelationshipSelect b r -> ShowS
showsPrec :: Int -> RemoteRelationshipSelect b r -> ShowS
$cshow :: forall (b :: BackendType) r.
(Backend b, Show r) =>
RemoteRelationshipSelect b r -> String
show :: RemoteRelationshipSelect b r -> String
$cshowList :: forall (b :: BackendType) r.
(Backend b, Show r) =>
[RemoteRelationshipSelect b r] -> ShowS
showList :: [RemoteRelationshipSelect b r] -> ShowS
Show, (forall a b.
 (a -> b)
 -> RemoteRelationshipSelect b a -> RemoteRelationshipSelect b b)
-> (forall a b.
    a -> RemoteRelationshipSelect b b -> RemoteRelationshipSelect b a)
-> Functor (RemoteRelationshipSelect b)
forall a b.
a -> RemoteRelationshipSelect b b -> RemoteRelationshipSelect b a
forall a b.
(a -> b)
-> RemoteRelationshipSelect b a -> RemoteRelationshipSelect b b
forall (b :: BackendType) a b.
a -> RemoteRelationshipSelect b b -> RemoteRelationshipSelect b a
forall (b :: BackendType) a b.
(a -> b)
-> RemoteRelationshipSelect b a -> RemoteRelationshipSelect b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) a b.
(a -> b)
-> RemoteRelationshipSelect b a -> RemoteRelationshipSelect b b
fmap :: forall a b.
(a -> b)
-> RemoteRelationshipSelect b a -> RemoteRelationshipSelect b b
$c<$ :: forall (b :: BackendType) a b.
a -> RemoteRelationshipSelect b b -> RemoteRelationshipSelect b a
<$ :: forall a b.
a -> RemoteRelationshipSelect b b -> RemoteRelationshipSelect b a
Functor, (forall m. Monoid m => RemoteRelationshipSelect b m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> RemoteRelationshipSelect b a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> RemoteRelationshipSelect b a -> m)
-> (forall a b.
    (a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b)
-> (forall a b.
    (a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b)
-> (forall a. (a -> a -> a) -> RemoteRelationshipSelect b a -> a)
-> (forall a. (a -> a -> a) -> RemoteRelationshipSelect b a -> a)
-> (forall a. RemoteRelationshipSelect b a -> [a])
-> (forall a. RemoteRelationshipSelect b a -> Bool)
-> (forall a. RemoteRelationshipSelect b a -> Int)
-> (forall a. Eq a => a -> RemoteRelationshipSelect b a -> Bool)
-> (forall a. Ord a => RemoteRelationshipSelect b a -> a)
-> (forall a. Ord a => RemoteRelationshipSelect b a -> a)
-> (forall a. Num a => RemoteRelationshipSelect b a -> a)
-> (forall a. Num a => RemoteRelationshipSelect b a -> a)
-> Foldable (RemoteRelationshipSelect b)
forall a. Eq a => a -> RemoteRelationshipSelect b a -> Bool
forall a. Num a => RemoteRelationshipSelect b a -> a
forall a. Ord a => RemoteRelationshipSelect b a -> a
forall m. Monoid m => RemoteRelationshipSelect b m -> m
forall a. RemoteRelationshipSelect b a -> Bool
forall a. RemoteRelationshipSelect b a -> Int
forall a. RemoteRelationshipSelect b a -> [a]
forall a. (a -> a -> a) -> RemoteRelationshipSelect b a -> a
forall m a.
Monoid m =>
(a -> m) -> RemoteRelationshipSelect b a -> m
forall b a. (b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
forall a b. (a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
forall (b :: BackendType) a.
Eq a =>
a -> RemoteRelationshipSelect b a -> Bool
forall (b :: BackendType) a.
Num a =>
RemoteRelationshipSelect b a -> a
forall (b :: BackendType) a.
Ord a =>
RemoteRelationshipSelect b a -> a
forall (b :: BackendType) m.
Monoid m =>
RemoteRelationshipSelect b m -> m
forall (b :: BackendType) a. RemoteRelationshipSelect b a -> Bool
forall (b :: BackendType) a. RemoteRelationshipSelect b a -> Int
forall (b :: BackendType) a. RemoteRelationshipSelect b a -> [a]
forall (b :: BackendType) a.
(a -> a -> a) -> RemoteRelationshipSelect b a -> a
forall (b :: BackendType) m a.
Monoid m =>
(a -> m) -> RemoteRelationshipSelect b a -> m
forall (b :: BackendType) b a.
(b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
forall (b :: BackendType) a b.
(a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) m.
Monoid m =>
RemoteRelationshipSelect b m -> m
fold :: forall m. Monoid m => RemoteRelationshipSelect b m -> m
$cfoldMap :: forall (b :: BackendType) m a.
Monoid m =>
(a -> m) -> RemoteRelationshipSelect b a -> m
foldMap :: forall m a.
Monoid m =>
(a -> m) -> RemoteRelationshipSelect b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
Monoid m =>
(a -> m) -> RemoteRelationshipSelect b a -> m
foldMap' :: forall m a.
Monoid m =>
(a -> m) -> RemoteRelationshipSelect b a -> m
$cfoldr :: forall (b :: BackendType) a b.
(a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
foldr :: forall a b. (a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
(a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
$cfoldl :: forall (b :: BackendType) b a.
(b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
foldl :: forall b a. (b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
(b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
$cfoldr1 :: forall (b :: BackendType) a.
(a -> a -> a) -> RemoteRelationshipSelect b a -> a
foldr1 :: forall a. (a -> a -> a) -> RemoteRelationshipSelect b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
(a -> a -> a) -> RemoteRelationshipSelect b a -> a
foldl1 :: forall a. (a -> a -> a) -> RemoteRelationshipSelect b a -> a
$ctoList :: forall (b :: BackendType) a. RemoteRelationshipSelect b a -> [a]
toList :: forall a. RemoteRelationshipSelect b a -> [a]
$cnull :: forall (b :: BackendType) a. RemoteRelationshipSelect b a -> Bool
null :: forall a. RemoteRelationshipSelect b a -> Bool
$clength :: forall (b :: BackendType) a. RemoteRelationshipSelect b a -> Int
length :: forall a. RemoteRelationshipSelect b a -> Int
$celem :: forall (b :: BackendType) a.
Eq a =>
a -> RemoteRelationshipSelect b a -> Bool
elem :: forall a. Eq a => a -> RemoteRelationshipSelect b a -> Bool
$cmaximum :: forall (b :: BackendType) a.
Ord a =>
RemoteRelationshipSelect b a -> a
maximum :: forall a. Ord a => RemoteRelationshipSelect b a -> a
$cminimum :: forall (b :: BackendType) a.
Ord a =>
RemoteRelationshipSelect b a -> a
minimum :: forall a. Ord a => RemoteRelationshipSelect b a -> a
$csum :: forall (b :: BackendType) a.
Num a =>
RemoteRelationshipSelect b a -> a
sum :: forall a. Num a => RemoteRelationshipSelect b a -> a
$cproduct :: forall (b :: BackendType) a.
Num a =>
RemoteRelationshipSelect b a -> a
product :: forall a. Num a => RemoteRelationshipSelect b a -> a
Foldable, Functor (RemoteRelationshipSelect b)
Foldable (RemoteRelationshipSelect b)
Functor (RemoteRelationshipSelect b)
-> Foldable (RemoteRelationshipSelect b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b)
    -> RemoteRelationshipSelect b a
    -> f (RemoteRelationshipSelect b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    RemoteRelationshipSelect b (f a)
    -> f (RemoteRelationshipSelect b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b)
    -> RemoteRelationshipSelect b a
    -> m (RemoteRelationshipSelect b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    RemoteRelationshipSelect b (m a)
    -> m (RemoteRelationshipSelect b a))
-> Traversable (RemoteRelationshipSelect b)
forall (b :: BackendType). Functor (RemoteRelationshipSelect b)
forall (b :: BackendType). Foldable (RemoteRelationshipSelect b)
forall (b :: BackendType) (m :: * -> *) a.
Monad m =>
RemoteRelationshipSelect b (m a)
-> m (RemoteRelationshipSelect b a)
forall (b :: BackendType) (f :: * -> *) a.
Applicative f =>
RemoteRelationshipSelect b (f a)
-> f (RemoteRelationshipSelect b a)
forall (b :: BackendType) (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> RemoteRelationshipSelect b a -> m (RemoteRelationshipSelect b b)
forall (b :: BackendType) (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> RemoteRelationshipSelect b a -> f (RemoteRelationshipSelect b b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
RemoteRelationshipSelect b (m a)
-> m (RemoteRelationshipSelect b a)
forall (f :: * -> *) a.
Applicative f =>
RemoteRelationshipSelect b (f a)
-> f (RemoteRelationshipSelect b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> RemoteRelationshipSelect b a -> m (RemoteRelationshipSelect b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> RemoteRelationshipSelect b a -> f (RemoteRelationshipSelect b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> RemoteRelationshipSelect b a -> f (RemoteRelationshipSelect b b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> RemoteRelationshipSelect b a -> f (RemoteRelationshipSelect b b)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
Applicative f =>
RemoteRelationshipSelect b (f a)
-> f (RemoteRelationshipSelect b a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
RemoteRelationshipSelect b (f a)
-> f (RemoteRelationshipSelect b a)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> RemoteRelationshipSelect b a -> m (RemoteRelationshipSelect b b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> RemoteRelationshipSelect b a -> m (RemoteRelationshipSelect b b)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
Monad m =>
RemoteRelationshipSelect b (m a)
-> m (RemoteRelationshipSelect b a)
sequence :: forall (m :: * -> *) a.
Monad m =>
RemoteRelationshipSelect b (m a)
-> m (RemoteRelationshipSelect b a)
Traversable)

data AnnFieldG (b :: BackendType) (r :: Type) v
  = AFColumn (AnnColumnField b v)
  | AFObjectRelation (ObjectRelationSelectG b r v)
  | AFArrayRelation (ArraySelectG b r v)
  | AFComputedField (XComputedField b) ComputedFieldName (ComputedFieldSelect b r v)
  | -- | A remote relationship field
    AFRemote (RemoteRelationshipSelect b r)
  | AFNodeId (XRelay b) SourceName (TableName b) (PrimaryKeyColumns b)
  | AFExpression Text
  | -- | Nested object.
    AFNestedObject (AnnNestedObjectSelectG b r v) -- TODO(dmoverton): move XNestedObject to a field in AFNestedObject constructor for consistency with AFNestedArray
  | -- | Nested array
    AFNestedArray (XNestedObjects b) (AnnNestedArraySelectG b r v)
  deriving stock ((forall a b. (a -> b) -> AnnFieldG b r a -> AnnFieldG b r b)
-> (forall a b. a -> AnnFieldG b r b -> AnnFieldG b r a)
-> Functor (AnnFieldG b r)
forall a b. a -> AnnFieldG b r b -> AnnFieldG b r a
forall a b. (a -> b) -> AnnFieldG b r a -> AnnFieldG b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> AnnFieldG b r b -> AnnFieldG b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> AnnFieldG b r a -> AnnFieldG b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> AnnFieldG b r a -> AnnFieldG b r b
fmap :: forall a b. (a -> b) -> AnnFieldG b r a -> AnnFieldG b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> AnnFieldG b r b -> AnnFieldG b r a
<$ :: forall a b. a -> AnnFieldG b r b -> AnnFieldG b r a
Functor, (forall m. Monoid m => AnnFieldG b r m -> m)
-> (forall m a. Monoid m => (a -> m) -> AnnFieldG b r a -> m)
-> (forall m a. Monoid m => (a -> m) -> AnnFieldG b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> AnnFieldG b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> AnnFieldG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnFieldG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnFieldG b r a -> b)
-> (forall a. (a -> a -> a) -> AnnFieldG b r a -> a)
-> (forall a. (a -> a -> a) -> AnnFieldG b r a -> a)
-> (forall a. AnnFieldG b r a -> [a])
-> (forall a. AnnFieldG b r a -> Bool)
-> (forall a. AnnFieldG b r a -> Int)
-> (forall a. Eq a => a -> AnnFieldG b r a -> Bool)
-> (forall a. Ord a => AnnFieldG b r a -> a)
-> (forall a. Ord a => AnnFieldG b r a -> a)
-> (forall a. Num a => AnnFieldG b r a -> a)
-> (forall a. Num a => AnnFieldG b r a -> a)
-> Foldable (AnnFieldG b r)
forall a. Eq a => a -> AnnFieldG b r a -> Bool
forall a. Num a => AnnFieldG b r a -> a
forall a. Ord a => AnnFieldG b r a -> a
forall m. Monoid m => AnnFieldG b r m -> m
forall a. AnnFieldG b r a -> Bool
forall a. AnnFieldG b r a -> Int
forall a. AnnFieldG b r a -> [a]
forall a. (a -> a -> a) -> AnnFieldG b r a -> a
forall m a. Monoid m => (a -> m) -> AnnFieldG b r a -> m
forall b a. (b -> a -> b) -> b -> AnnFieldG b r a -> b
forall a b. (a -> b -> b) -> b -> AnnFieldG b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnFieldG b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnFieldG b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnFieldG b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnFieldG b r m -> m
forall (b :: BackendType) r a. Backend b => AnnFieldG b r a -> Bool
forall (b :: BackendType) r a. Backend b => AnnFieldG b r a -> Int
forall (b :: BackendType) r a. Backend b => AnnFieldG b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnFieldG b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnFieldG b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnFieldG b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnFieldG b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnFieldG b r m -> m
fold :: forall m. Monoid m => AnnFieldG b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnFieldG b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> AnnFieldG b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnFieldG b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> AnnFieldG b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnFieldG b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> AnnFieldG b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnFieldG b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> AnnFieldG b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnFieldG b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> AnnFieldG b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnFieldG b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> AnnFieldG b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnFieldG b r a -> a
foldr1 :: forall a. (a -> a -> a) -> AnnFieldG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnFieldG b r a -> a
foldl1 :: forall a. (a -> a -> a) -> AnnFieldG b r a -> a
$ctoList :: forall (b :: BackendType) r a. Backend b => AnnFieldG b r a -> [a]
toList :: forall a. AnnFieldG b r a -> [a]
$cnull :: forall (b :: BackendType) r a. Backend b => AnnFieldG b r a -> Bool
null :: forall a. AnnFieldG b r a -> Bool
$clength :: forall (b :: BackendType) r a. Backend b => AnnFieldG b r a -> Int
length :: forall a. AnnFieldG b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnFieldG b r a -> Bool
elem :: forall a. Eq a => a -> AnnFieldG b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnFieldG b r a -> a
maximum :: forall a. Ord a => AnnFieldG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnFieldG b r a -> a
minimum :: forall a. Ord a => AnnFieldG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnFieldG b r a -> a
sum :: forall a. Num a => AnnFieldG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnFieldG b r a -> a
product :: forall a. Num a => AnnFieldG b r a -> a
Foldable, Functor (AnnFieldG b r)
Foldable (AnnFieldG b r)
Functor (AnnFieldG b r)
-> Foldable (AnnFieldG b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> AnnFieldG b r a -> f (AnnFieldG b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnFieldG b r (f a) -> f (AnnFieldG b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> AnnFieldG b r a -> m (AnnFieldG b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnFieldG b r (m a) -> m (AnnFieldG b r a))
-> Traversable (AnnFieldG b r)
forall (b :: BackendType) r. Backend b => Functor (AnnFieldG b r)
forall (b :: BackendType) r. Backend b => Foldable (AnnFieldG b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnFieldG b r (m a) -> m (AnnFieldG b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnFieldG b r (f a) -> f (AnnFieldG b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnFieldG b r a -> m (AnnFieldG b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AnnFieldG b r a -> f (AnnFieldG b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
AnnFieldG b r (m a) -> m (AnnFieldG b r a)
forall (f :: * -> *) a.
Applicative f =>
AnnFieldG b r (f a) -> f (AnnFieldG b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnFieldG b r a -> m (AnnFieldG b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnFieldG b r a -> f (AnnFieldG b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AnnFieldG b r a -> f (AnnFieldG b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnFieldG b r a -> f (AnnFieldG b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnFieldG b r (f a) -> f (AnnFieldG b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
AnnFieldG b r (f a) -> f (AnnFieldG b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnFieldG b r a -> m (AnnFieldG b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnFieldG b r a -> m (AnnFieldG b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnFieldG b r (m a) -> m (AnnFieldG b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
AnnFieldG b r (m a) -> m (AnnFieldG b r a)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AnnColumnField b v),
    Eq (ArraySelectG b r v),
    Eq (ComputedFieldSelect b r v),
    Eq (ObjectRelationSelectG b r v),
    Eq (RemoteRelationshipSelect b r),
    Eq (AnnNestedObjectSelectG b r v),
    Eq (AnnNestedArraySelectG b r v)
  ) =>
  Eq (AnnFieldG b r v)

deriving stock instance
  ( Backend b,
    Show (AnnColumnField b v),
    Show (ArraySelectG b r v),
    Show (ComputedFieldSelect b r v),
    Show (ObjectRelationSelectG b r v),
    Show (RemoteRelationshipSelect b r),
    Show (AnnNestedObjectSelectG b r v),
    Show (AnnNestedArraySelectG b r v)
  ) =>
  Show (AnnFieldG b r v)

instance (Backend b) => Bifoldable (AnnFieldG b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnFieldG b a b -> m
bifoldMap a -> m
f b -> m
g = \case
    AFColumn AnnColumnField b b
col -> (b -> m) -> AnnColumnField b b -> m
forall m a. Monoid m => (a -> m) -> AnnColumnField b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap b -> m
g AnnColumnField b b
col
    AFObjectRelation ObjectRelationSelectG b a b
objRel -> (AnnObjectSelectG b a b -> m) -> ObjectRelationSelectG b a b -> m
forall m a. Monoid m => (a -> m) -> AnnRelationSelectG b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((a -> m) -> (b -> m) -> AnnObjectSelectG b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnObjectSelectG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g) ObjectRelationSelectG b a b
objRel
    AFArrayRelation ArraySelectG b a b
arrRel -> (a -> m) -> (b -> m) -> ArraySelectG b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> ArraySelectG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g ArraySelectG b a b
arrRel
    AFComputedField XComputedField b
_ ComputedFieldName
_ ComputedFieldSelect b a b
cf -> (a -> m) -> (b -> m) -> ComputedFieldSelect b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> ComputedFieldSelect b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g ComputedFieldSelect b a b
cf
    AFRemote RemoteRelationshipSelect b a
r -> (a -> m) -> RemoteRelationshipSelect b a -> m
forall m a.
Monoid m =>
(a -> m) -> RemoteRelationshipSelect b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap a -> m
f RemoteRelationshipSelect b a
r
    AFNodeId {} -> m
forall a. Monoid a => a
mempty
    AFExpression {} -> m
forall a. Monoid a => a
mempty
    AFNestedObject AnnNestedObjectSelectG b a b
no -> (a -> m) -> (b -> m) -> AnnNestedObjectSelectG b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnNestedObjectSelectG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g AnnNestedObjectSelectG b a b
no
    AFNestedArray XNestedObjects b
_ AnnNestedArraySelectG b a b
na -> (a -> m) -> (b -> m) -> AnnNestedArraySelectG b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnNestedArraySelectG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g AnnNestedArraySelectG b a b
na

type AnnField b = AnnFieldG b Void (SQLExpression b)

type AnnFields b = AnnFieldsG b Void (SQLExpression b)

mkAnnColumnField ::
  Column backend ->
  ColumnType backend ->
  AnnRedactionExp backend v ->
  Maybe (ScalarSelectionArguments backend) ->
  AnnFieldG backend r v
mkAnnColumnField :: forall (backend :: BackendType) v r.
Column backend
-> ColumnType backend
-> AnnRedactionExp backend v
-> Maybe (ScalarSelectionArguments backend)
-> AnnFieldG backend r v
mkAnnColumnField Column backend
col ColumnType backend
typ AnnRedactionExp backend v
redactionExp Maybe (ScalarSelectionArguments backend)
colOpM =
  AnnColumnField backend v -> AnnFieldG backend r v
forall (b :: BackendType) r v.
AnnColumnField b v -> AnnFieldG b r v
AFColumn (Column backend
-> ColumnType backend
-> Bool
-> Maybe (ScalarSelectionArguments backend)
-> AnnRedactionExp backend v
-> AnnColumnField backend v
forall (b :: BackendType) v.
Column b
-> ColumnType b
-> Bool
-> Maybe (ScalarSelectionArguments b)
-> AnnRedactionExp b v
-> AnnColumnField b v
AnnColumnField Column backend
col ColumnType backend
typ Bool
False Maybe (ScalarSelectionArguments backend)
colOpM AnnRedactionExp backend v
redactionExp)

mkAnnColumnFieldAsText ::
  ColumnInfo backend ->
  AnnFieldG backend r v
mkAnnColumnFieldAsText :: forall (backend :: BackendType) r v.
ColumnInfo backend -> AnnFieldG backend r v
mkAnnColumnFieldAsText ColumnInfo backend
ci =
  AnnColumnField backend v -> AnnFieldG backend r v
forall (b :: BackendType) r v.
AnnColumnField b v -> AnnFieldG b r v
AFColumn (Column backend
-> ColumnType backend
-> Bool
-> Maybe (ScalarSelectionArguments backend)
-> AnnRedactionExp backend v
-> AnnColumnField backend v
forall (b :: BackendType) v.
Column b
-> ColumnType b
-> Bool
-> Maybe (ScalarSelectionArguments b)
-> AnnRedactionExp b v
-> AnnColumnField b v
AnnColumnField (ColumnInfo backend -> Column backend
forall (b :: BackendType). ColumnInfo b -> Column b
ciColumn ColumnInfo backend
ci) (ColumnInfo backend -> ColumnType backend
forall (b :: BackendType). ColumnInfo b -> ColumnType b
ciType ColumnInfo backend
ci) Bool
True Maybe (ScalarSelectionArguments backend)
forall a. Maybe a
Nothing AnnRedactionExp backend v
forall (b :: BackendType) v. AnnRedactionExp b v
NoRedaction)

traverseSourceRelationshipSelection ::
  (Applicative f, Backend backend) =>
  (vf backend -> f (vg backend)) ->
  SourceRelationshipSelection backend r vf ->
  f (SourceRelationshipSelection backend r vg)
traverseSourceRelationshipSelection :: forall (f :: * -> *) (backend :: BackendType)
       (vf :: BackendType -> *) (vg :: BackendType -> *) r.
(Applicative f, Backend backend) =>
(vf backend -> f (vg backend))
-> SourceRelationshipSelection backend r vf
-> f (SourceRelationshipSelection backend r vg)
traverseSourceRelationshipSelection vf backend -> f (vg backend)
f = \case
  SourceRelationshipObject AnnObjectSelectG backend r (vf backend)
s ->
    AnnObjectSelectG backend r (vg backend)
-> SourceRelationshipSelection backend r vg
forall (b :: BackendType) r (vf :: BackendType -> *).
AnnObjectSelectG b r (vf b) -> SourceRelationshipSelection b r vf
SourceRelationshipObject (AnnObjectSelectG backend r (vg backend)
 -> SourceRelationshipSelection backend r vg)
-> f (AnnObjectSelectG backend r (vg backend))
-> f (SourceRelationshipSelection backend r vg)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (vf backend -> f (vg backend))
-> AnnObjectSelectG backend r (vf backend)
-> f (AnnObjectSelectG backend r (vg backend))
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)
-> AnnObjectSelectG backend r a -> f (AnnObjectSelectG backend r b)
traverse vf backend -> f (vg backend)
f AnnObjectSelectG backend r (vf backend)
s
  SourceRelationshipArray AnnSimpleSelectG backend r (vf backend)
s ->
    AnnSimpleSelectG backend r (vg backend)
-> SourceRelationshipSelection backend r vg
forall (b :: BackendType) r (vf :: BackendType -> *).
AnnSimpleSelectG b r (vf b) -> SourceRelationshipSelection b r vf
SourceRelationshipArray (AnnSimpleSelectG backend r (vg backend)
 -> SourceRelationshipSelection backend r vg)
-> f (AnnSimpleSelectG backend r (vg backend))
-> f (SourceRelationshipSelection backend r vg)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (vf backend -> f (vg backend))
-> AnnSimpleSelectG backend r (vf backend)
-> f (AnnSimpleSelectG backend r (vg backend))
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)
-> AnnSelectG backend (AnnFieldG backend r) a
-> f (AnnSelectG backend (AnnFieldG backend r) b)
traverse vf backend -> f (vg backend)
f AnnSimpleSelectG backend r (vf backend)
s
  SourceRelationshipArrayAggregate AnnAggregateSelectG backend r (vf backend)
s ->
    AnnAggregateSelectG backend r (vg backend)
-> SourceRelationshipSelection backend r vg
forall (b :: BackendType) r (vf :: BackendType -> *).
AnnAggregateSelectG b r (vf b)
-> SourceRelationshipSelection b r vf
SourceRelationshipArrayAggregate (AnnAggregateSelectG backend r (vg backend)
 -> SourceRelationshipSelection backend r vg)
-> f (AnnAggregateSelectG backend r (vg backend))
-> f (SourceRelationshipSelection backend r vg)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (vf backend -> f (vg backend))
-> AnnAggregateSelectG backend r (vf backend)
-> f (AnnAggregateSelectG backend r (vg backend))
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)
-> AnnSelectG backend (TableAggregateFieldG backend r) a
-> f (AnnSelectG backend (TableAggregateFieldG backend r) b)
traverse vf backend -> f (vg backend)
f AnnAggregateSelectG backend r (vf backend)
s

-- Aggregation fields

data TableAggregateFieldG (b :: BackendType) (r :: Type) v
  = TAFAgg (AggregateFields b v)
  | TAFNodes (XNodesAgg b) (AnnFieldsG b r v)
  | TAFGroupBy (XGroupBy b) (GroupByG b r v)
  | TAFExp Text
  deriving stock ((forall a b.
 (a -> b)
 -> TableAggregateFieldG b r a -> TableAggregateFieldG b r b)
-> (forall a b.
    a -> TableAggregateFieldG b r b -> TableAggregateFieldG b r a)
-> Functor (TableAggregateFieldG b r)
forall a b.
a -> TableAggregateFieldG b r b -> TableAggregateFieldG b r a
forall a b.
(a -> b)
-> TableAggregateFieldG b r a -> TableAggregateFieldG b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> TableAggregateFieldG b r b -> TableAggregateFieldG b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b)
-> TableAggregateFieldG b r a -> TableAggregateFieldG b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b)
-> TableAggregateFieldG b r a -> TableAggregateFieldG b r b
fmap :: forall a b.
(a -> b)
-> TableAggregateFieldG b r a -> TableAggregateFieldG b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> TableAggregateFieldG b r b -> TableAggregateFieldG b r a
<$ :: forall a b.
a -> TableAggregateFieldG b r b -> TableAggregateFieldG b r a
Functor, (forall m. Monoid m => TableAggregateFieldG b r m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> TableAggregateFieldG b r a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> TableAggregateFieldG b r a -> m)
-> (forall a b.
    (a -> b -> b) -> b -> TableAggregateFieldG b r a -> b)
-> (forall a b.
    (a -> b -> b) -> b -> TableAggregateFieldG b r a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> TableAggregateFieldG b r a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> TableAggregateFieldG b r a -> b)
-> (forall a. (a -> a -> a) -> TableAggregateFieldG b r a -> a)
-> (forall a. (a -> a -> a) -> TableAggregateFieldG b r a -> a)
-> (forall a. TableAggregateFieldG b r a -> [a])
-> (forall a. TableAggregateFieldG b r a -> Bool)
-> (forall a. TableAggregateFieldG b r a -> Int)
-> (forall a. Eq a => a -> TableAggregateFieldG b r a -> Bool)
-> (forall a. Ord a => TableAggregateFieldG b r a -> a)
-> (forall a. Ord a => TableAggregateFieldG b r a -> a)
-> (forall a. Num a => TableAggregateFieldG b r a -> a)
-> (forall a. Num a => TableAggregateFieldG b r a -> a)
-> Foldable (TableAggregateFieldG b r)
forall a. Eq a => a -> TableAggregateFieldG b r a -> Bool
forall a. Num a => TableAggregateFieldG b r a -> a
forall a. Ord a => TableAggregateFieldG b r a -> a
forall m. Monoid m => TableAggregateFieldG b r m -> m
forall a. TableAggregateFieldG b r a -> Bool
forall a. TableAggregateFieldG b r a -> Int
forall a. TableAggregateFieldG b r a -> [a]
forall a. (a -> a -> a) -> TableAggregateFieldG b r a -> a
forall m a. Monoid m => (a -> m) -> TableAggregateFieldG b r a -> m
forall b a. (b -> a -> b) -> b -> TableAggregateFieldG b r a -> b
forall a b. (a -> b -> b) -> b -> TableAggregateFieldG b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> TableAggregateFieldG b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
TableAggregateFieldG b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
TableAggregateFieldG b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
TableAggregateFieldG b r m -> m
forall (b :: BackendType) r a.
Backend b =>
TableAggregateFieldG b r a -> Bool
forall (b :: BackendType) r a.
Backend b =>
TableAggregateFieldG b r a -> Int
forall (b :: BackendType) r a.
Backend b =>
TableAggregateFieldG b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> TableAggregateFieldG b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> TableAggregateFieldG b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> TableAggregateFieldG b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> TableAggregateFieldG b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
TableAggregateFieldG b r m -> m
fold :: forall m. Monoid m => TableAggregateFieldG b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> TableAggregateFieldG b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> TableAggregateFieldG b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> TableAggregateFieldG b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> TableAggregateFieldG b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> TableAggregateFieldG b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> TableAggregateFieldG b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> TableAggregateFieldG b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> TableAggregateFieldG b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> TableAggregateFieldG b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> TableAggregateFieldG b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> TableAggregateFieldG b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> TableAggregateFieldG b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> TableAggregateFieldG b r a -> a
foldr1 :: forall a. (a -> a -> a) -> TableAggregateFieldG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> TableAggregateFieldG b r a -> a
foldl1 :: forall a. (a -> a -> a) -> TableAggregateFieldG b r a -> a
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
TableAggregateFieldG b r a -> [a]
toList :: forall a. TableAggregateFieldG b r a -> [a]
$cnull :: forall (b :: BackendType) r a.
Backend b =>
TableAggregateFieldG b r a -> Bool
null :: forall a. TableAggregateFieldG b r a -> Bool
$clength :: forall (b :: BackendType) r a.
Backend b =>
TableAggregateFieldG b r a -> Int
length :: forall a. TableAggregateFieldG b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> TableAggregateFieldG b r a -> Bool
elem :: forall a. Eq a => a -> TableAggregateFieldG b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
TableAggregateFieldG b r a -> a
maximum :: forall a. Ord a => TableAggregateFieldG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
TableAggregateFieldG b r a -> a
minimum :: forall a. Ord a => TableAggregateFieldG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
TableAggregateFieldG b r a -> a
sum :: forall a. Num a => TableAggregateFieldG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
TableAggregateFieldG b r a -> a
product :: forall a. Num a => TableAggregateFieldG b r a -> a
Foldable, Functor (TableAggregateFieldG b r)
Foldable (TableAggregateFieldG b r)
Functor (TableAggregateFieldG b r)
-> Foldable (TableAggregateFieldG b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b)
    -> TableAggregateFieldG b r a -> f (TableAggregateFieldG b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    TableAggregateFieldG b r (f a) -> f (TableAggregateFieldG b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b)
    -> TableAggregateFieldG b r a -> m (TableAggregateFieldG b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    TableAggregateFieldG b r (m a) -> m (TableAggregateFieldG b r a))
-> Traversable (TableAggregateFieldG b r)
forall (b :: BackendType) r.
Backend b =>
Functor (TableAggregateFieldG b r)
forall (b :: BackendType) r.
Backend b =>
Foldable (TableAggregateFieldG b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
TableAggregateFieldG b r (m a) -> m (TableAggregateFieldG b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
TableAggregateFieldG b r (f a) -> f (TableAggregateFieldG b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> TableAggregateFieldG b r a -> m (TableAggregateFieldG b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> TableAggregateFieldG b r a -> f (TableAggregateFieldG b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
TableAggregateFieldG b r (m a) -> m (TableAggregateFieldG b r a)
forall (f :: * -> *) a.
Applicative f =>
TableAggregateFieldG b r (f a) -> f (TableAggregateFieldG b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> TableAggregateFieldG b r a -> m (TableAggregateFieldG b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> TableAggregateFieldG b r a -> f (TableAggregateFieldG b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> TableAggregateFieldG b r a -> f (TableAggregateFieldG b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> TableAggregateFieldG b r a -> f (TableAggregateFieldG b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
TableAggregateFieldG b r (f a) -> f (TableAggregateFieldG b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
TableAggregateFieldG b r (f a) -> f (TableAggregateFieldG b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> TableAggregateFieldG b r a -> m (TableAggregateFieldG b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> TableAggregateFieldG b r a -> m (TableAggregateFieldG b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
TableAggregateFieldG b r (m a) -> m (TableAggregateFieldG b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
TableAggregateFieldG b r (m a) -> m (TableAggregateFieldG b r a)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AggregateFields b v),
    Eq (AnnFieldsG b r v),
    Eq (GroupByG b r v)
  ) =>
  Eq (TableAggregateFieldG b r v)

deriving stock instance
  ( Backend b,
    Show (AggregateFields b v),
    Show (AnnFieldsG b r v),
    Show (GroupByG b r v)
  ) =>
  Show (TableAggregateFieldG b r v)

instance (Backend b) => Bifoldable (TableAggregateFieldG b) where
  bifoldMap :: (Monoid m) => (r -> m) -> (v -> m) -> TableAggregateFieldG b r v -> m
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> TableAggregateFieldG b a b -> m
bifoldMap r -> m
mapR v -> m
mapV = \case
    TAFAgg AggregateFields b v
aggFields -> ((FieldName, AggregateField b v) -> m) -> AggregateFields b v -> m
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AggregateField b v -> m) -> (FieldName, AggregateField b v) -> m
forall m a. Monoid m => (a -> m) -> (FieldName, a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AggregateField b v -> m) -> (FieldName, AggregateField b v) -> m)
-> (AggregateField b v -> m)
-> (FieldName, AggregateField b v)
-> m
forall a b. (a -> b) -> a -> b
$ (v -> m) -> AggregateField b v -> m
forall m a. Monoid m => (a -> m) -> AggregateField b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap v -> m
mapV) AggregateFields b v
aggFields
    TAFNodes XNodesAgg b
_ AnnFieldsG b r v
fields -> ((FieldName, AnnFieldG b r v) -> m) -> AnnFieldsG b r v -> m
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b r v -> m) -> (FieldName, AnnFieldG b r v) -> m
forall m a. Monoid m => (a -> m) -> (FieldName, a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b r v -> m) -> (FieldName, AnnFieldG b r v) -> m)
-> (AnnFieldG b r v -> m) -> (FieldName, AnnFieldG b r v) -> m
forall a b. (a -> b) -> a -> b
$ (r -> m) -> (v -> m) -> AnnFieldG b r v -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap r -> m
mapR v -> m
mapV) AnnFieldsG b r v
fields
    TAFGroupBy XGroupBy b
_ GroupByG b r v
groupByFields -> (r -> m) -> (v -> m) -> GroupByG b r v -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> GroupByG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap r -> m
mapR v -> m
mapV GroupByG b r v
groupByFields
    TAFExp {} -> m
forall a. Monoid a => a
mempty

data AggregateField (b :: BackendType) v
  = AFCount (CountType b v)
  | AFOp (AggregateOp b v)
  | AFExp Text

deriving stock instance (Backend b) => Functor (AggregateField b)

deriving stock instance (Backend b) => Foldable (AggregateField b)

deriving stock instance (Backend b) => Traversable (AggregateField b)

deriving stock instance
  (Backend b, Eq (CountType b v), Eq (AggregateOp b v), Eq v) =>
  Eq (AggregateField b v)

deriving stock instance
  (Backend b, Show (CountType b v), Show (AggregateOp b v), Show v) =>
  Show (AggregateField b v)

data AggregateOp (b :: BackendType) v = AggregateOp
  { forall (b :: BackendType) v. AggregateOp b v -> Text
_aoOp :: Text,
    forall (b :: BackendType) v. AggregateOp b v -> SelectionFields b v
_aoFields :: SelectionFields b v
  }
  deriving ((forall a b. (a -> b) -> AggregateOp b a -> AggregateOp b b)
-> (forall a b. a -> AggregateOp b b -> AggregateOp b a)
-> Functor (AggregateOp b)
forall a b. a -> AggregateOp b b -> AggregateOp b a
forall a b. (a -> b) -> AggregateOp b a -> AggregateOp b b
forall (b :: BackendType) a b.
Backend b =>
a -> AggregateOp b b -> AggregateOp b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> AggregateOp b a -> AggregateOp b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> AggregateOp b a -> AggregateOp b b
fmap :: forall a b. (a -> b) -> AggregateOp b a -> AggregateOp b b
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> AggregateOp b b -> AggregateOp b a
<$ :: forall a b. a -> AggregateOp b b -> AggregateOp b a
Functor, (forall m. Monoid m => AggregateOp b m -> m)
-> (forall m a. Monoid m => (a -> m) -> AggregateOp b a -> m)
-> (forall m a. Monoid m => (a -> m) -> AggregateOp b a -> m)
-> (forall a b. (a -> b -> b) -> b -> AggregateOp b a -> b)
-> (forall a b. (a -> b -> b) -> b -> AggregateOp b a -> b)
-> (forall b a. (b -> a -> b) -> b -> AggregateOp b a -> b)
-> (forall b a. (b -> a -> b) -> b -> AggregateOp b a -> b)
-> (forall a. (a -> a -> a) -> AggregateOp b a -> a)
-> (forall a. (a -> a -> a) -> AggregateOp b a -> a)
-> (forall a. AggregateOp b a -> [a])
-> (forall a. AggregateOp b a -> Bool)
-> (forall a. AggregateOp b a -> Int)
-> (forall a. Eq a => a -> AggregateOp b a -> Bool)
-> (forall a. Ord a => AggregateOp b a -> a)
-> (forall a. Ord a => AggregateOp b a -> a)
-> (forall a. Num a => AggregateOp b a -> a)
-> (forall a. Num a => AggregateOp b a -> a)
-> Foldable (AggregateOp b)
forall a. Eq a => a -> AggregateOp b a -> Bool
forall a. Num a => AggregateOp b a -> a
forall a. Ord a => AggregateOp b a -> a
forall m. Monoid m => AggregateOp b m -> m
forall a. AggregateOp b a -> Bool
forall a. AggregateOp b a -> Int
forall a. AggregateOp b a -> [a]
forall a. (a -> a -> a) -> AggregateOp b a -> a
forall m a. Monoid m => (a -> m) -> AggregateOp b a -> m
forall b a. (b -> a -> b) -> b -> AggregateOp b a -> b
forall a b. (a -> b -> b) -> b -> AggregateOp b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> AggregateOp b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
AggregateOp b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
AggregateOp b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
AggregateOp b m -> m
forall (b :: BackendType) a. Backend b => AggregateOp b a -> Bool
forall (b :: BackendType) a. Backend b => AggregateOp b a -> Int
forall (b :: BackendType) a. Backend b => AggregateOp b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AggregateOp b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AggregateOp b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AggregateOp b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AggregateOp b a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
AggregateOp b m -> m
fold :: forall m. Monoid m => AggregateOp b m -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AggregateOp b a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> AggregateOp b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AggregateOp b a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> AggregateOp b a -> m
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AggregateOp b a -> b
foldr :: forall a b. (a -> b -> b) -> b -> AggregateOp b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AggregateOp b a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> AggregateOp b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AggregateOp b a -> b
foldl :: forall b a. (b -> a -> b) -> b -> AggregateOp b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AggregateOp b a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> AggregateOp b a -> b
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AggregateOp b a -> a
foldr1 :: forall a. (a -> a -> a) -> AggregateOp b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AggregateOp b a -> a
foldl1 :: forall a. (a -> a -> a) -> AggregateOp b a -> a
$ctoList :: forall (b :: BackendType) a. Backend b => AggregateOp b a -> [a]
toList :: forall a. AggregateOp b a -> [a]
$cnull :: forall (b :: BackendType) a. Backend b => AggregateOp b a -> Bool
null :: forall a. AggregateOp b a -> Bool
$clength :: forall (b :: BackendType) a. Backend b => AggregateOp b a -> Int
length :: forall a. AggregateOp b a -> Int
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> AggregateOp b a -> Bool
elem :: forall a. Eq a => a -> AggregateOp b a -> Bool
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
AggregateOp b a -> a
maximum :: forall a. Ord a => AggregateOp b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
AggregateOp b a -> a
minimum :: forall a. Ord a => AggregateOp b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
AggregateOp b a -> a
sum :: forall a. Num a => AggregateOp b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
AggregateOp b a -> a
product :: forall a. Num a => AggregateOp b a -> a
Foldable, Functor (AggregateOp b)
Foldable (AggregateOp b)
Functor (AggregateOp b)
-> Foldable (AggregateOp b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> AggregateOp b a -> f (AggregateOp b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AggregateOp b (f a) -> f (AggregateOp b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> AggregateOp b a -> m (AggregateOp b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AggregateOp b (m a) -> m (AggregateOp b a))
-> Traversable (AggregateOp b)
forall (b :: BackendType). Backend b => Functor (AggregateOp b)
forall (b :: BackendType). Backend b => Foldable (AggregateOp b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
AggregateOp b (m a) -> m (AggregateOp b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
AggregateOp b (f a) -> f (AggregateOp b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AggregateOp b a -> m (AggregateOp b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AggregateOp b a -> f (AggregateOp b b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
AggregateOp b (m a) -> m (AggregateOp b a)
forall (f :: * -> *) a.
Applicative f =>
AggregateOp b (f a) -> f (AggregateOp b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AggregateOp b a -> m (AggregateOp b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AggregateOp b a -> f (AggregateOp b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AggregateOp b a -> f (AggregateOp b b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AggregateOp b a -> f (AggregateOp b b)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
AggregateOp b (f a) -> f (AggregateOp b a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
AggregateOp b (f a) -> f (AggregateOp b a)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AggregateOp b a -> m (AggregateOp b b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AggregateOp b a -> m (AggregateOp b b)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
AggregateOp b (m a) -> m (AggregateOp b a)
sequence :: forall (m :: * -> *) a.
Monad m =>
AggregateOp b (m a) -> m (AggregateOp b a)
Traversable)

deriving stock instance
  (Backend b, Eq (SelectionFields b v), Eq v) =>
  Eq (AggregateOp b v)

deriving stock instance
  (Backend b, Show (SelectionFields b v), Show v) =>
  Show (AggregateOp b v)

data GroupByG (b :: BackendType) r v = GroupByG
  { forall (b :: BackendType) r v. GroupByG b r v -> [GroupKeyField b]
_gbgKeys :: [GroupKeyField b],
    forall (b :: BackendType) r v.
GroupByG b r v -> Fields (GroupByField b r v)
_gbgFields :: Fields (GroupByField b r v)
  }
  deriving ((forall a b. (a -> b) -> GroupByG b r a -> GroupByG b r b)
-> (forall a b. a -> GroupByG b r b -> GroupByG b r a)
-> Functor (GroupByG b r)
forall a b. a -> GroupByG b r b -> GroupByG b r a
forall a b. (a -> b) -> GroupByG b r a -> GroupByG b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> GroupByG b r b -> GroupByG b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> GroupByG b r a -> GroupByG b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> GroupByG b r a -> GroupByG b r b
fmap :: forall a b. (a -> b) -> GroupByG b r a -> GroupByG b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> GroupByG b r b -> GroupByG b r a
<$ :: forall a b. a -> GroupByG b r b -> GroupByG b r a
Functor, (forall m. Monoid m => GroupByG b r m -> m)
-> (forall m a. Monoid m => (a -> m) -> GroupByG b r a -> m)
-> (forall m a. Monoid m => (a -> m) -> GroupByG b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> GroupByG b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> GroupByG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> GroupByG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> GroupByG b r a -> b)
-> (forall a. (a -> a -> a) -> GroupByG b r a -> a)
-> (forall a. (a -> a -> a) -> GroupByG b r a -> a)
-> (forall a. GroupByG b r a -> [a])
-> (forall a. GroupByG b r a -> Bool)
-> (forall a. GroupByG b r a -> Int)
-> (forall a. Eq a => a -> GroupByG b r a -> Bool)
-> (forall a. Ord a => GroupByG b r a -> a)
-> (forall a. Ord a => GroupByG b r a -> a)
-> (forall a. Num a => GroupByG b r a -> a)
-> (forall a. Num a => GroupByG b r a -> a)
-> Foldable (GroupByG b r)
forall a. Eq a => a -> GroupByG b r a -> Bool
forall a. Num a => GroupByG b r a -> a
forall a. Ord a => GroupByG b r a -> a
forall m. Monoid m => GroupByG b r m -> m
forall a. GroupByG b r a -> Bool
forall a. GroupByG b r a -> Int
forall a. GroupByG b r a -> [a]
forall a. (a -> a -> a) -> GroupByG b r a -> a
forall m a. Monoid m => (a -> m) -> GroupByG b r a -> m
forall b a. (b -> a -> b) -> b -> GroupByG b r a -> b
forall a b. (a -> b -> b) -> b -> GroupByG b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> GroupByG b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
GroupByG b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
GroupByG b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
GroupByG b r m -> m
forall (b :: BackendType) r a. Backend b => GroupByG b r a -> Bool
forall (b :: BackendType) r a. Backend b => GroupByG b r a -> Int
forall (b :: BackendType) r a. Backend b => GroupByG b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> GroupByG b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> GroupByG b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> GroupByG b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> GroupByG b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
GroupByG b r m -> m
fold :: forall m. Monoid m => GroupByG b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> GroupByG b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> GroupByG b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> GroupByG b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> GroupByG b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> GroupByG b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> GroupByG b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> GroupByG b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> GroupByG b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> GroupByG b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> GroupByG b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> GroupByG b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> GroupByG b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> GroupByG b r a -> a
foldr1 :: forall a. (a -> a -> a) -> GroupByG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> GroupByG b r a -> a
foldl1 :: forall a. (a -> a -> a) -> GroupByG b r a -> a
$ctoList :: forall (b :: BackendType) r a. Backend b => GroupByG b r a -> [a]
toList :: forall a. GroupByG b r a -> [a]
$cnull :: forall (b :: BackendType) r a. Backend b => GroupByG b r a -> Bool
null :: forall a. GroupByG b r a -> Bool
$clength :: forall (b :: BackendType) r a. Backend b => GroupByG b r a -> Int
length :: forall a. GroupByG b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> GroupByG b r a -> Bool
elem :: forall a. Eq a => a -> GroupByG b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
GroupByG b r a -> a
maximum :: forall a. Ord a => GroupByG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
GroupByG b r a -> a
minimum :: forall a. Ord a => GroupByG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
GroupByG b r a -> a
sum :: forall a. Num a => GroupByG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
GroupByG b r a -> a
product :: forall a. Num a => GroupByG b r a -> a
Foldable, Functor (GroupByG b r)
Foldable (GroupByG b r)
Functor (GroupByG b r)
-> Foldable (GroupByG b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> GroupByG b r a -> f (GroupByG b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    GroupByG b r (f a) -> f (GroupByG b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> GroupByG b r a -> m (GroupByG b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    GroupByG b r (m a) -> m (GroupByG b r a))
-> Traversable (GroupByG b r)
forall (b :: BackendType) r. Backend b => Functor (GroupByG b r)
forall (b :: BackendType) r. Backend b => Foldable (GroupByG b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
GroupByG b r (m a) -> m (GroupByG b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
GroupByG b r (f a) -> f (GroupByG b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> GroupByG b r a -> m (GroupByG b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> GroupByG b r a -> f (GroupByG b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
GroupByG b r (m a) -> m (GroupByG b r a)
forall (f :: * -> *) a.
Applicative f =>
GroupByG b r (f a) -> f (GroupByG b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> GroupByG b r a -> m (GroupByG b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> GroupByG b r a -> f (GroupByG b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> GroupByG b r a -> f (GroupByG b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> GroupByG b r a -> f (GroupByG b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
GroupByG b r (f a) -> f (GroupByG b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
GroupByG b r (f a) -> f (GroupByG b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> GroupByG b r a -> m (GroupByG b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> GroupByG b r a -> m (GroupByG b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
GroupByG b r (m a) -> m (GroupByG b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
GroupByG b r (m a) -> m (GroupByG b r a)
Traversable)

deriving stock instance (Backend b, Eq (GroupByField b r v), Eq (GroupKeyField b)) => Eq (GroupByG b r v)

deriving stock instance (Backend b, Show (GroupByField b r v), Show (GroupKeyField b)) => Show (GroupByG b r v)

instance (Backend b) => Bifoldable (GroupByG b) where
  bifoldMap :: (Monoid m) => (r -> m) -> (v -> m) -> GroupByG b r v -> m
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> GroupByG b a b -> m
bifoldMap r -> m
mapR v -> m
mapV GroupByG {Fields (GroupByField b r v)
[GroupKeyField b]
$sel:_gbgKeys:GroupByG :: forall (b :: BackendType) r v. GroupByG b r v -> [GroupKeyField b]
$sel:_gbgFields:GroupByG :: forall (b :: BackendType) r v.
GroupByG b r v -> Fields (GroupByField b r v)
_gbgKeys :: [GroupKeyField b]
_gbgFields :: Fields (GroupByField b r v)
..} =
    ((FieldName, GroupByField b r v) -> m)
-> Fields (GroupByField b r v) -> m
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((GroupByField b r v -> m) -> (FieldName, GroupByField b r v) -> m
forall m a. Monoid m => (a -> m) -> (FieldName, a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((GroupByField b r v -> m) -> (FieldName, GroupByField b r v) -> m)
-> (GroupByField b r v -> m)
-> (FieldName, GroupByField b r v)
-> m
forall a b. (a -> b) -> a -> b
$ (r -> m) -> (v -> m) -> GroupByField b r v -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> GroupByField b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap r -> m
mapR v -> m
mapV) Fields (GroupByField b r v)
_gbgFields

data GroupByField (b :: BackendType) r v
  = GBFGroupKey (Fields (GroupKeyField b))
  | GBFAggregate (AggregateFields b v)
  | GBFNodes (AnnFieldsG b r v)
  | GBFExp Text
  deriving ((forall a b. (a -> b) -> GroupByField b r a -> GroupByField b r b)
-> (forall a b. a -> GroupByField b r b -> GroupByField b r a)
-> Functor (GroupByField b r)
forall a b. a -> GroupByField b r b -> GroupByField b r a
forall a b. (a -> b) -> GroupByField b r a -> GroupByField b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> GroupByField b r b -> GroupByField b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> GroupByField b r a -> GroupByField b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> GroupByField b r a -> GroupByField b r b
fmap :: forall a b. (a -> b) -> GroupByField b r a -> GroupByField b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> GroupByField b r b -> GroupByField b r a
<$ :: forall a b. a -> GroupByField b r b -> GroupByField b r a
Functor, (forall m. Monoid m => GroupByField b r m -> m)
-> (forall m a. Monoid m => (a -> m) -> GroupByField b r a -> m)
-> (forall m a. Monoid m => (a -> m) -> GroupByField b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> GroupByField b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> GroupByField b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> GroupByField b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> GroupByField b r a -> b)
-> (forall a. (a -> a -> a) -> GroupByField b r a -> a)
-> (forall a. (a -> a -> a) -> GroupByField b r a -> a)
-> (forall a. GroupByField b r a -> [a])
-> (forall a. GroupByField b r a -> Bool)
-> (forall a. GroupByField b r a -> Int)
-> (forall a. Eq a => a -> GroupByField b r a -> Bool)
-> (forall a. Ord a => GroupByField b r a -> a)
-> (forall a. Ord a => GroupByField b r a -> a)
-> (forall a. Num a => GroupByField b r a -> a)
-> (forall a. Num a => GroupByField b r a -> a)
-> Foldable (GroupByField b r)
forall a. Eq a => a -> GroupByField b r a -> Bool
forall a. Num a => GroupByField b r a -> a
forall a. Ord a => GroupByField b r a -> a
forall m. Monoid m => GroupByField b r m -> m
forall a. GroupByField b r a -> Bool
forall a. GroupByField b r a -> Int
forall a. GroupByField b r a -> [a]
forall a. (a -> a -> a) -> GroupByField b r a -> a
forall m a. Monoid m => (a -> m) -> GroupByField b r a -> m
forall b a. (b -> a -> b) -> b -> GroupByField b r a -> b
forall a b. (a -> b -> b) -> b -> GroupByField b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> GroupByField b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
GroupByField b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
GroupByField b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
GroupByField b r m -> m
forall (b :: BackendType) r a.
Backend b =>
GroupByField b r a -> Bool
forall (b :: BackendType) r a.
Backend b =>
GroupByField b r a -> Int
forall (b :: BackendType) r a.
Backend b =>
GroupByField b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> GroupByField b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> GroupByField b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> GroupByField b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> GroupByField b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
GroupByField b r m -> m
fold :: forall m. Monoid m => GroupByField b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> GroupByField b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> GroupByField b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> GroupByField b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> GroupByField b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> GroupByField b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> GroupByField b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> GroupByField b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> GroupByField b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> GroupByField b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> GroupByField b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> GroupByField b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> GroupByField b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> GroupByField b r a -> a
foldr1 :: forall a. (a -> a -> a) -> GroupByField b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> GroupByField b r a -> a
foldl1 :: forall a. (a -> a -> a) -> GroupByField b r a -> a
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
GroupByField b r a -> [a]
toList :: forall a. GroupByField b r a -> [a]
$cnull :: forall (b :: BackendType) r a.
Backend b =>
GroupByField b r a -> Bool
null :: forall a. GroupByField b r a -> Bool
$clength :: forall (b :: BackendType) r a.
Backend b =>
GroupByField b r a -> Int
length :: forall a. GroupByField b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> GroupByField b r a -> Bool
elem :: forall a. Eq a => a -> GroupByField b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
GroupByField b r a -> a
maximum :: forall a. Ord a => GroupByField b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
GroupByField b r a -> a
minimum :: forall a. Ord a => GroupByField b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
GroupByField b r a -> a
sum :: forall a. Num a => GroupByField b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
GroupByField b r a -> a
product :: forall a. Num a => GroupByField b r a -> a
Foldable, Functor (GroupByField b r)
Foldable (GroupByField b r)
Functor (GroupByField b r)
-> Foldable (GroupByField b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> GroupByField b r a -> f (GroupByField b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    GroupByField b r (f a) -> f (GroupByField b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> GroupByField b r a -> m (GroupByField b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    GroupByField b r (m a) -> m (GroupByField b r a))
-> Traversable (GroupByField b r)
forall (b :: BackendType) r.
Backend b =>
Functor (GroupByField b r)
forall (b :: BackendType) r.
Backend b =>
Foldable (GroupByField b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
GroupByField b r (m a) -> m (GroupByField b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
GroupByField b r (f a) -> f (GroupByField b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> GroupByField b r a -> m (GroupByField b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> GroupByField b r a -> f (GroupByField b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
GroupByField b r (m a) -> m (GroupByField b r a)
forall (f :: * -> *) a.
Applicative f =>
GroupByField b r (f a) -> f (GroupByField b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> GroupByField b r a -> m (GroupByField b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> GroupByField b r a -> f (GroupByField b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> GroupByField b r a -> f (GroupByField b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> GroupByField b r a -> f (GroupByField b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
GroupByField b r (f a) -> f (GroupByField b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
GroupByField b r (f a) -> f (GroupByField b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> GroupByField b r a -> m (GroupByField b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> GroupByField b r a -> m (GroupByField b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
GroupByField b r (m a) -> m (GroupByField b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
GroupByField b r (m a) -> m (GroupByField b r a)
Traversable)

deriving stock instance (Backend b, Eq (GroupKeyField b), Eq (AggregateField b v), Eq (AnnFieldG b r v)) => Eq (GroupByField b r v)

deriving stock instance (Backend b, Show (GroupKeyField b), Show (AggregateField b v), Show (AnnFieldG b r v)) => Show (GroupByField b r v)

instance (Backend b) => Bifoldable (GroupByField b) where
  bifoldMap :: (Monoid m) => (r -> m) -> (v -> m) -> GroupByField b r v -> m
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> GroupByField b a b -> m
bifoldMap r -> m
mapR v -> m
mapV = \case
    GBFGroupKey Fields (GroupKeyField b)
_groupKeyFields -> m
forall a. Monoid a => a
mempty
    GBFAggregate AggregateFields b v
aggFields -> ((FieldName, AggregateField b v) -> m) -> AggregateFields b v -> m
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AggregateField b v -> m) -> (FieldName, AggregateField b v) -> m
forall m a. Monoid m => (a -> m) -> (FieldName, a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AggregateField b v -> m) -> (FieldName, AggregateField b v) -> m)
-> (AggregateField b v -> m)
-> (FieldName, AggregateField b v)
-> m
forall a b. (a -> b) -> a -> b
$ (v -> m) -> AggregateField b v -> m
forall m a. Monoid m => (a -> m) -> AggregateField b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap v -> m
mapV) AggregateFields b v
aggFields
    GBFNodes AnnFieldsG b r v
fields -> ((FieldName, AnnFieldG b r v) -> m) -> AnnFieldsG b r v -> m
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b r v -> m) -> (FieldName, AnnFieldG b r v) -> m
forall m a. Monoid m => (a -> m) -> (FieldName, a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b r v -> m) -> (FieldName, AnnFieldG b r v) -> m)
-> (AnnFieldG b r v -> m) -> (FieldName, AnnFieldG b r v) -> m
forall a b. (a -> b) -> a -> b
$ (r -> m) -> (v -> m) -> AnnFieldG b r v -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap r -> m
mapR v -> m
mapV) AnnFieldsG b r v
fields
    GBFExp Text
_text -> m
forall a. Monoid a => a
mempty

data GroupKeyField (b :: BackendType)
  = GKFColumn (Column b)
  | GKFExp Text

deriving stock instance (Backend b) => Eq (GroupKeyField b)

deriving stock instance (Backend b) => Show (GroupKeyField b)

-- | Types of fields that can be selected in a user query.
data SelectionField (b :: BackendType) v
  = SFCol
      (Column b)
      (ColumnType b)
      -- | This type is used to determine whether the column should be redacted
      -- before being aggregated
      (AnnRedactionExp b v)
  | SFComputedField ComputedFieldName (ComputedFieldScalarSelect b v)
  | SFExp Text
  deriving ((forall a b. (a -> b) -> SelectionField b a -> SelectionField b b)
-> (forall a b. a -> SelectionField b b -> SelectionField b a)
-> Functor (SelectionField b)
forall a b. a -> SelectionField b b -> SelectionField b a
forall a b. (a -> b) -> SelectionField b a -> SelectionField b b
forall (b :: BackendType) a b.
Backend b =>
a -> SelectionField b b -> SelectionField b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> SelectionField b a -> SelectionField b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> SelectionField b a -> SelectionField b b
fmap :: forall a b. (a -> b) -> SelectionField b a -> SelectionField b b
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> SelectionField b b -> SelectionField b a
<$ :: forall a b. a -> SelectionField b b -> SelectionField b a
Functor, (forall m. Monoid m => SelectionField b m -> m)
-> (forall m a. Monoid m => (a -> m) -> SelectionField b a -> m)
-> (forall m a. Monoid m => (a -> m) -> SelectionField b a -> m)
-> (forall a b. (a -> b -> b) -> b -> SelectionField b a -> b)
-> (forall a b. (a -> b -> b) -> b -> SelectionField b a -> b)
-> (forall b a. (b -> a -> b) -> b -> SelectionField b a -> b)
-> (forall b a. (b -> a -> b) -> b -> SelectionField b a -> b)
-> (forall a. (a -> a -> a) -> SelectionField b a -> a)
-> (forall a. (a -> a -> a) -> SelectionField b a -> a)
-> (forall a. SelectionField b a -> [a])
-> (forall a. SelectionField b a -> Bool)
-> (forall a. SelectionField b a -> Int)
-> (forall a. Eq a => a -> SelectionField b a -> Bool)
-> (forall a. Ord a => SelectionField b a -> a)
-> (forall a. Ord a => SelectionField b a -> a)
-> (forall a. Num a => SelectionField b a -> a)
-> (forall a. Num a => SelectionField b a -> a)
-> Foldable (SelectionField b)
forall a. Eq a => a -> SelectionField b a -> Bool
forall a. Num a => SelectionField b a -> a
forall a. Ord a => SelectionField b a -> a
forall m. Monoid m => SelectionField b m -> m
forall a. SelectionField b a -> Bool
forall a. SelectionField b a -> Int
forall a. SelectionField b a -> [a]
forall a. (a -> a -> a) -> SelectionField b a -> a
forall m a. Monoid m => (a -> m) -> SelectionField b a -> m
forall b a. (b -> a -> b) -> b -> SelectionField b a -> b
forall a b. (a -> b -> b) -> b -> SelectionField b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> SelectionField b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
SelectionField b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
SelectionField b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
SelectionField b m -> m
forall (b :: BackendType) a.
Backend b =>
SelectionField b a -> Bool
forall (b :: BackendType) a. Backend b => SelectionField b a -> Int
forall (b :: BackendType) a. Backend b => SelectionField b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> SelectionField b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> SelectionField b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> SelectionField b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> SelectionField b a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
SelectionField b m -> m
fold :: forall m. Monoid m => SelectionField b m -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> SelectionField b a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> SelectionField b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> SelectionField b a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> SelectionField b a -> m
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> SelectionField b a -> b
foldr :: forall a b. (a -> b -> b) -> b -> SelectionField b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> SelectionField b a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> SelectionField b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> SelectionField b a -> b
foldl :: forall b a. (b -> a -> b) -> b -> SelectionField b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> SelectionField b a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> SelectionField b a -> b
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> SelectionField b a -> a
foldr1 :: forall a. (a -> a -> a) -> SelectionField b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> SelectionField b a -> a
foldl1 :: forall a. (a -> a -> a) -> SelectionField b a -> a
$ctoList :: forall (b :: BackendType) a. Backend b => SelectionField b a -> [a]
toList :: forall a. SelectionField b a -> [a]
$cnull :: forall (b :: BackendType) a.
Backend b =>
SelectionField b a -> Bool
null :: forall a. SelectionField b a -> Bool
$clength :: forall (b :: BackendType) a. Backend b => SelectionField b a -> Int
length :: forall a. SelectionField b a -> Int
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> SelectionField b a -> Bool
elem :: forall a. Eq a => a -> SelectionField b a -> Bool
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
SelectionField b a -> a
maximum :: forall a. Ord a => SelectionField b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
SelectionField b a -> a
minimum :: forall a. Ord a => SelectionField b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
SelectionField b a -> a
sum :: forall a. Num a => SelectionField b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
SelectionField b a -> a
product :: forall a. Num a => SelectionField b a -> a
Foldable, Functor (SelectionField b)
Foldable (SelectionField b)
Functor (SelectionField b)
-> Foldable (SelectionField b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> SelectionField b a -> f (SelectionField b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    SelectionField b (f a) -> f (SelectionField b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> SelectionField b a -> m (SelectionField b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    SelectionField b (m a) -> m (SelectionField b a))
-> Traversable (SelectionField b)
forall (b :: BackendType). Backend b => Functor (SelectionField b)
forall (b :: BackendType). Backend b => Foldable (SelectionField b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
SelectionField b (m a) -> m (SelectionField b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
SelectionField b (f a) -> f (SelectionField b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> SelectionField b a -> m (SelectionField b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> SelectionField b a -> f (SelectionField b b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
SelectionField b (m a) -> m (SelectionField b a)
forall (f :: * -> *) a.
Applicative f =>
SelectionField b (f a) -> f (SelectionField b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> SelectionField b a -> m (SelectionField b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> SelectionField b a -> f (SelectionField b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> SelectionField b a -> f (SelectionField b b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> SelectionField b a -> f (SelectionField b b)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
SelectionField b (f a) -> f (SelectionField b a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
SelectionField b (f a) -> f (SelectionField b a)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> SelectionField b a -> m (SelectionField b b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> SelectionField b a -> m (SelectionField b b)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
SelectionField b (m a) -> m (SelectionField b a)
sequence :: forall (m :: * -> *) a.
Monad m =>
SelectionField b (m a) -> m (SelectionField b a)
Traversable)

deriving stock instance
  (Backend b, Eq (FunctionArgumentExp b v), Eq (AnnRedactionExp b v), Eq v) =>
  Eq (SelectionField b v)

deriving stock instance
  (Backend b, Show (FunctionArgumentExp b v), Show (AnnRedactionExp b v), Show v) =>
  Show (SelectionField b v)

type TableAggregateField b = TableAggregateFieldG b Void (SQLExpression b)

type TableAggregateFields b = TableAggregateFieldsG b Void (SQLExpression b)

type TableAggregateFieldsG b r v = Fields (TableAggregateFieldG b r v)

type SelectionFields b v = Fields (SelectionField b v)

type AggregateFields b v = Fields (AggregateField b v)

type AnnFieldsG b r v = Fields (AnnFieldG b r v)

-- Relay fields

data ConnectionField (b :: BackendType) (r :: Type) v
  = ConnectionTypename Text
  | ConnectionPageInfo PageInfoFields
  | ConnectionEdges (EdgeFields b r v)
  deriving stock ((forall a b.
 (a -> b) -> ConnectionField b r a -> ConnectionField b r b)
-> (forall a b.
    a -> ConnectionField b r b -> ConnectionField b r a)
-> Functor (ConnectionField b r)
forall a b. a -> ConnectionField b r b -> ConnectionField b r a
forall a b.
(a -> b) -> ConnectionField b r a -> ConnectionField b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> ConnectionField b r b -> ConnectionField b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ConnectionField b r a -> ConnectionField b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ConnectionField b r a -> ConnectionField b r b
fmap :: forall a b.
(a -> b) -> ConnectionField b r a -> ConnectionField b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> ConnectionField b r b -> ConnectionField b r a
<$ :: forall a b. a -> ConnectionField b r b -> ConnectionField b r a
Functor, (forall m. Monoid m => ConnectionField b r m -> m)
-> (forall m a. Monoid m => (a -> m) -> ConnectionField b r a -> m)
-> (forall m a. Monoid m => (a -> m) -> ConnectionField b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> ConnectionField b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> ConnectionField b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> ConnectionField b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> ConnectionField b r a -> b)
-> (forall a. (a -> a -> a) -> ConnectionField b r a -> a)
-> (forall a. (a -> a -> a) -> ConnectionField b r a -> a)
-> (forall a. ConnectionField b r a -> [a])
-> (forall a. ConnectionField b r a -> Bool)
-> (forall a. ConnectionField b r a -> Int)
-> (forall a. Eq a => a -> ConnectionField b r a -> Bool)
-> (forall a. Ord a => ConnectionField b r a -> a)
-> (forall a. Ord a => ConnectionField b r a -> a)
-> (forall a. Num a => ConnectionField b r a -> a)
-> (forall a. Num a => ConnectionField b r a -> a)
-> Foldable (ConnectionField b r)
forall a. Eq a => a -> ConnectionField b r a -> Bool
forall a. Num a => ConnectionField b r a -> a
forall a. Ord a => ConnectionField b r a -> a
forall m. Monoid m => ConnectionField b r m -> m
forall a. ConnectionField b r a -> Bool
forall a. ConnectionField b r a -> Int
forall a. ConnectionField b r a -> [a]
forall a. (a -> a -> a) -> ConnectionField b r a -> a
forall m a. Monoid m => (a -> m) -> ConnectionField b r a -> m
forall b a. (b -> a -> b) -> b -> ConnectionField b r a -> b
forall a b. (a -> b -> b) -> b -> ConnectionField b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ConnectionField b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionField b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionField b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ConnectionField b r m -> m
forall (b :: BackendType) r a.
Backend b =>
ConnectionField b r a -> Bool
forall (b :: BackendType) r a.
Backend b =>
ConnectionField b r a -> Int
forall (b :: BackendType) r a.
Backend b =>
ConnectionField b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionField b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionField b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionField b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionField b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ConnectionField b r m -> m
fold :: forall m. Monoid m => ConnectionField b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionField b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ConnectionField b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionField b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ConnectionField b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionField b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ConnectionField b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionField b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ConnectionField b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionField b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ConnectionField b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionField b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ConnectionField b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionField b r a -> a
foldr1 :: forall a. (a -> a -> a) -> ConnectionField b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionField b r a -> a
foldl1 :: forall a. (a -> a -> a) -> ConnectionField b r a -> a
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
ConnectionField b r a -> [a]
toList :: forall a. ConnectionField b r a -> [a]
$cnull :: forall (b :: BackendType) r a.
Backend b =>
ConnectionField b r a -> Bool
null :: forall a. ConnectionField b r a -> Bool
$clength :: forall (b :: BackendType) r a.
Backend b =>
ConnectionField b r a -> Int
length :: forall a. ConnectionField b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ConnectionField b r a -> Bool
elem :: forall a. Eq a => a -> ConnectionField b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionField b r a -> a
maximum :: forall a. Ord a => ConnectionField b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionField b r a -> a
minimum :: forall a. Ord a => ConnectionField b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionField b r a -> a
sum :: forall a. Num a => ConnectionField b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionField b r a -> a
product :: forall a. Num a => ConnectionField b r a -> a
Foldable, Functor (ConnectionField b r)
Foldable (ConnectionField b r)
Functor (ConnectionField b r)
-> Foldable (ConnectionField b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> ConnectionField b r a -> f (ConnectionField b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    ConnectionField b r (f a) -> f (ConnectionField b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> ConnectionField b r a -> m (ConnectionField b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    ConnectionField b r (m a) -> m (ConnectionField b r a))
-> Traversable (ConnectionField b r)
forall (b :: BackendType) r.
Backend b =>
Functor (ConnectionField b r)
forall (b :: BackendType) r.
Backend b =>
Foldable (ConnectionField b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ConnectionField b r (m a) -> m (ConnectionField b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ConnectionField b r (f a) -> f (ConnectionField b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ConnectionField b r a -> m (ConnectionField b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> ConnectionField b r a -> f (ConnectionField b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
ConnectionField b r (m a) -> m (ConnectionField b r a)
forall (f :: * -> *) a.
Applicative f =>
ConnectionField b r (f a) -> f (ConnectionField b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConnectionField b r a -> m (ConnectionField b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConnectionField b r a -> f (ConnectionField b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> ConnectionField b r a -> f (ConnectionField b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ConnectionField b r a -> f (ConnectionField b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ConnectionField b r (f a) -> f (ConnectionField b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ConnectionField b r (f a) -> f (ConnectionField b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ConnectionField b r a -> m (ConnectionField b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ConnectionField b r a -> m (ConnectionField b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ConnectionField b r (m a) -> m (ConnectionField b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ConnectionField b r (m a) -> m (ConnectionField b r a)
Traversable)

deriving stock instance
  ( Eq (EdgeFields b r v)
  ) =>
  Eq (ConnectionField b r v)

deriving stock instance
  ( Show (EdgeFields b r v)
  ) =>
  Show (ConnectionField b r v)

instance (Backend b) => Bifoldable (ConnectionField b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> ConnectionField b a b -> m
bifoldMap a -> m
f b -> m
g = \case
    ConnectionTypename {} -> m
forall a. Monoid a => a
mempty
    ConnectionPageInfo {} -> m
forall a. Monoid a => a
mempty
    ConnectionEdges EdgeFields b a b
edgeFields -> ((FieldName, EdgeField b a b) -> m) -> EdgeFields b a b -> m
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((EdgeField b a b -> m) -> (FieldName, EdgeField b a b) -> m
forall m a. Monoid m => (a -> m) -> (FieldName, a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((EdgeField b a b -> m) -> (FieldName, EdgeField b a b) -> m)
-> (EdgeField b a b -> m) -> (FieldName, EdgeField b a b) -> m
forall a b. (a -> b) -> a -> b
$ (a -> m) -> (b -> m) -> EdgeField b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> EdgeField b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g) EdgeFields b a b
edgeFields

data PageInfoField
  = PageInfoTypename Text
  | PageInfoHasNextPage
  | PageInfoHasPreviousPage
  | PageInfoStartCursor
  | PageInfoEndCursor
  deriving stock (Int -> PageInfoField -> ShowS
[PageInfoField] -> ShowS
PageInfoField -> String
(Int -> PageInfoField -> ShowS)
-> (PageInfoField -> String)
-> ([PageInfoField] -> ShowS)
-> Show PageInfoField
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PageInfoField -> ShowS
showsPrec :: Int -> PageInfoField -> ShowS
$cshow :: PageInfoField -> String
show :: PageInfoField -> String
$cshowList :: [PageInfoField] -> ShowS
showList :: [PageInfoField] -> ShowS
Show, PageInfoField -> PageInfoField -> Bool
(PageInfoField -> PageInfoField -> Bool)
-> (PageInfoField -> PageInfoField -> Bool) -> Eq PageInfoField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PageInfoField -> PageInfoField -> Bool
== :: PageInfoField -> PageInfoField -> Bool
$c/= :: PageInfoField -> PageInfoField -> Bool
/= :: PageInfoField -> PageInfoField -> Bool
Eq)

data EdgeField (b :: BackendType) (r :: Type) v
  = EdgeTypename Text
  | EdgeCursor
  | EdgeNode (AnnFieldsG b r v)
  deriving stock ((forall a b. (a -> b) -> EdgeField b r a -> EdgeField b r b)
-> (forall a b. a -> EdgeField b r b -> EdgeField b r a)
-> Functor (EdgeField b r)
forall a b. a -> EdgeField b r b -> EdgeField b r a
forall a b. (a -> b) -> EdgeField b r a -> EdgeField b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> EdgeField b r b -> EdgeField b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> EdgeField b r a -> EdgeField b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> EdgeField b r a -> EdgeField b r b
fmap :: forall a b. (a -> b) -> EdgeField b r a -> EdgeField b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> EdgeField b r b -> EdgeField b r a
<$ :: forall a b. a -> EdgeField b r b -> EdgeField b r a
Functor, (forall m. Monoid m => EdgeField b r m -> m)
-> (forall m a. Monoid m => (a -> m) -> EdgeField b r a -> m)
-> (forall m a. Monoid m => (a -> m) -> EdgeField b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> EdgeField b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> EdgeField b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> EdgeField b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> EdgeField b r a -> b)
-> (forall a. (a -> a -> a) -> EdgeField b r a -> a)
-> (forall a. (a -> a -> a) -> EdgeField b r a -> a)
-> (forall a. EdgeField b r a -> [a])
-> (forall a. EdgeField b r a -> Bool)
-> (forall a. EdgeField b r a -> Int)
-> (forall a. Eq a => a -> EdgeField b r a -> Bool)
-> (forall a. Ord a => EdgeField b r a -> a)
-> (forall a. Ord a => EdgeField b r a -> a)
-> (forall a. Num a => EdgeField b r a -> a)
-> (forall a. Num a => EdgeField b r a -> a)
-> Foldable (EdgeField b r)
forall a. Eq a => a -> EdgeField b r a -> Bool
forall a. Num a => EdgeField b r a -> a
forall a. Ord a => EdgeField b r a -> a
forall m. Monoid m => EdgeField b r m -> m
forall a. EdgeField b r a -> Bool
forall a. EdgeField b r a -> Int
forall a. EdgeField b r a -> [a]
forall a. (a -> a -> a) -> EdgeField b r a -> a
forall m a. Monoid m => (a -> m) -> EdgeField b r a -> m
forall b a. (b -> a -> b) -> b -> EdgeField b r a -> b
forall a b. (a -> b -> b) -> b -> EdgeField b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> EdgeField b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
EdgeField b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
EdgeField b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
EdgeField b r m -> m
forall (b :: BackendType) r a. Backend b => EdgeField b r a -> Bool
forall (b :: BackendType) r a. Backend b => EdgeField b r a -> Int
forall (b :: BackendType) r a. Backend b => EdgeField b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> EdgeField b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> EdgeField b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> EdgeField b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> EdgeField b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
EdgeField b r m -> m
fold :: forall m. Monoid m => EdgeField b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> EdgeField b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> EdgeField b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> EdgeField b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> EdgeField b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> EdgeField b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> EdgeField b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> EdgeField b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> EdgeField b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> EdgeField b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> EdgeField b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> EdgeField b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> EdgeField b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> EdgeField b r a -> a
foldr1 :: forall a. (a -> a -> a) -> EdgeField b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> EdgeField b r a -> a
foldl1 :: forall a. (a -> a -> a) -> EdgeField b r a -> a
$ctoList :: forall (b :: BackendType) r a. Backend b => EdgeField b r a -> [a]
toList :: forall a. EdgeField b r a -> [a]
$cnull :: forall (b :: BackendType) r a. Backend b => EdgeField b r a -> Bool
null :: forall a. EdgeField b r a -> Bool
$clength :: forall (b :: BackendType) r a. Backend b => EdgeField b r a -> Int
length :: forall a. EdgeField b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> EdgeField b r a -> Bool
elem :: forall a. Eq a => a -> EdgeField b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
EdgeField b r a -> a
maximum :: forall a. Ord a => EdgeField b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
EdgeField b r a -> a
minimum :: forall a. Ord a => EdgeField b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
EdgeField b r a -> a
sum :: forall a. Num a => EdgeField b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
EdgeField b r a -> a
product :: forall a. Num a => EdgeField b r a -> a
Foldable, Functor (EdgeField b r)
Foldable (EdgeField b r)
Functor (EdgeField b r)
-> Foldable (EdgeField b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> EdgeField b r a -> f (EdgeField b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    EdgeField b r (f a) -> f (EdgeField b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> EdgeField b r a -> m (EdgeField b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    EdgeField b r (m a) -> m (EdgeField b r a))
-> Traversable (EdgeField b r)
forall (b :: BackendType) r. Backend b => Functor (EdgeField b r)
forall (b :: BackendType) r. Backend b => Foldable (EdgeField b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
EdgeField b r (m a) -> m (EdgeField b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
EdgeField b r (f a) -> f (EdgeField b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> EdgeField b r a -> m (EdgeField b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> EdgeField b r a -> f (EdgeField b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
EdgeField b r (m a) -> m (EdgeField b r a)
forall (f :: * -> *) a.
Applicative f =>
EdgeField b r (f a) -> f (EdgeField b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> EdgeField b r a -> m (EdgeField b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> EdgeField b r a -> f (EdgeField b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> EdgeField b r a -> f (EdgeField b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> EdgeField b r a -> f (EdgeField b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
EdgeField b r (f a) -> f (EdgeField b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
EdgeField b r (f a) -> f (EdgeField b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> EdgeField b r a -> m (EdgeField b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> EdgeField b r a -> m (EdgeField b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
EdgeField b r (m a) -> m (EdgeField b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
EdgeField b r (m a) -> m (EdgeField b r a)
Traversable)

deriving stock instance
  ( Eq (AnnFieldsG b r v)
  ) =>
  Eq (EdgeField b r v)

deriving stock instance
  ( Show (AnnFieldsG b r v)
  ) =>
  Show (EdgeField b r v)

instance (Backend b) => Bifoldable (EdgeField b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> EdgeField b a b -> m
bifoldMap a -> m
f b -> m
g = \case
    EdgeTypename {} -> m
forall a. Monoid a => a
mempty
    EdgeField b a b
EdgeCursor -> m
forall a. Monoid a => a
mempty
    EdgeNode AnnFieldsG b a b
annFields -> ((FieldName, AnnFieldG b a b) -> m) -> AnnFieldsG b a b -> m
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b a b -> m) -> (FieldName, AnnFieldG b a b) -> m
forall m a. Monoid m => (a -> m) -> (FieldName, a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b a b -> m) -> (FieldName, AnnFieldG b a b) -> m)
-> (AnnFieldG b a b -> m) -> (FieldName, AnnFieldG b a b) -> m
forall a b. (a -> b) -> a -> b
$ (a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g) AnnFieldsG b a b
annFields

type ConnectionFields b r v = Fields (ConnectionField b r v)

type PageInfoFields = Fields PageInfoField

type EdgeFields b r v = Fields (EdgeField b r v)

data AnnColumnField (b :: BackendType) v = AnnColumnField
  { forall (b :: BackendType) v. AnnColumnField b v -> Column b
_acfColumn :: Column b,
    forall (b :: BackendType) v. AnnColumnField b v -> ColumnType b
_acfType :: ColumnType b,
    -- | If this field is 'True', columns are explicitly casted to @text@ when
    -- fetched, which avoids an issue that occurs because we don’t currently
    -- have proper support for array types. See
    -- https://github.com/hasura/graphql-engine/pull/3198 for more details.
    forall (b :: BackendType) v. AnnColumnField b v -> Bool
_acfAsText :: Bool,
    -- | Arguments of this column's selection. See 'ScalarSelectionArguments'
    forall (b :: BackendType) v.
AnnColumnField b v -> Maybe (ScalarSelectionArguments b)
_acfArguments :: Maybe (ScalarSelectionArguments b),
    -- | This type is used to determine whether the column should be redacted
    forall (b :: BackendType) v.
AnnColumnField b v -> AnnRedactionExp b v
_acfRedactionExpression :: AnnRedactionExp b v
  }
  deriving stock ((forall a b. (a -> b) -> AnnColumnField b a -> AnnColumnField b b)
-> (forall a b. a -> AnnColumnField b b -> AnnColumnField b a)
-> Functor (AnnColumnField b)
forall a b. a -> AnnColumnField b b -> AnnColumnField b a
forall a b. (a -> b) -> AnnColumnField b a -> AnnColumnField b b
forall (b :: BackendType) a b.
Backend b =>
a -> AnnColumnField b b -> AnnColumnField b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> AnnColumnField b a -> AnnColumnField b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> AnnColumnField b a -> AnnColumnField b b
fmap :: forall a b. (a -> b) -> AnnColumnField b a -> AnnColumnField b b
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> AnnColumnField b b -> AnnColumnField b a
<$ :: forall a b. a -> AnnColumnField b b -> AnnColumnField b a
Functor, (forall m. Monoid m => AnnColumnField b m -> m)
-> (forall m a. Monoid m => (a -> m) -> AnnColumnField b a -> m)
-> (forall m a. Monoid m => (a -> m) -> AnnColumnField b a -> m)
-> (forall a b. (a -> b -> b) -> b -> AnnColumnField b a -> b)
-> (forall a b. (a -> b -> b) -> b -> AnnColumnField b a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnColumnField b a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnColumnField b a -> b)
-> (forall a. (a -> a -> a) -> AnnColumnField b a -> a)
-> (forall a. (a -> a -> a) -> AnnColumnField b a -> a)
-> (forall a. AnnColumnField b a -> [a])
-> (forall a. AnnColumnField b a -> Bool)
-> (forall a. AnnColumnField b a -> Int)
-> (forall a. Eq a => a -> AnnColumnField b a -> Bool)
-> (forall a. Ord a => AnnColumnField b a -> a)
-> (forall a. Ord a => AnnColumnField b a -> a)
-> (forall a. Num a => AnnColumnField b a -> a)
-> (forall a. Num a => AnnColumnField b a -> a)
-> Foldable (AnnColumnField b)
forall a. Eq a => a -> AnnColumnField b a -> Bool
forall a. Num a => AnnColumnField b a -> a
forall a. Ord a => AnnColumnField b a -> a
forall m. Monoid m => AnnColumnField b m -> m
forall a. AnnColumnField b a -> Bool
forall a. AnnColumnField b a -> Int
forall a. AnnColumnField b a -> [a]
forall a. (a -> a -> a) -> AnnColumnField b a -> a
forall m a. Monoid m => (a -> m) -> AnnColumnField b a -> m
forall b a. (b -> a -> b) -> b -> AnnColumnField b a -> b
forall a b. (a -> b -> b) -> b -> AnnColumnField b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> AnnColumnField b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
AnnColumnField b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
AnnColumnField b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
AnnColumnField b m -> m
forall (b :: BackendType) a.
Backend b =>
AnnColumnField b a -> Bool
forall (b :: BackendType) a. Backend b => AnnColumnField b a -> Int
forall (b :: BackendType) a. Backend b => AnnColumnField b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AnnColumnField b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnColumnField b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AnnColumnField b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AnnColumnField b a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
AnnColumnField b m -> m
fold :: forall m. Monoid m => AnnColumnField b m -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnColumnField b a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> AnnColumnField b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnColumnField b a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> AnnColumnField b a -> m
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AnnColumnField b a -> b
foldr :: forall a b. (a -> b -> b) -> b -> AnnColumnField b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AnnColumnField b a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> AnnColumnField b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AnnColumnField b a -> b
foldl :: forall b a. (b -> a -> b) -> b -> AnnColumnField b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AnnColumnField b a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> AnnColumnField b a -> b
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AnnColumnField b a -> a
foldr1 :: forall a. (a -> a -> a) -> AnnColumnField b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AnnColumnField b a -> a
foldl1 :: forall a. (a -> a -> a) -> AnnColumnField b a -> a
$ctoList :: forall (b :: BackendType) a. Backend b => AnnColumnField b a -> [a]
toList :: forall a. AnnColumnField b a -> [a]
$cnull :: forall (b :: BackendType) a.
Backend b =>
AnnColumnField b a -> Bool
null :: forall a. AnnColumnField b a -> Bool
$clength :: forall (b :: BackendType) a. Backend b => AnnColumnField b a -> Int
length :: forall a. AnnColumnField b a -> Int
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> AnnColumnField b a -> Bool
elem :: forall a. Eq a => a -> AnnColumnField b a -> Bool
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
AnnColumnField b a -> a
maximum :: forall a. Ord a => AnnColumnField b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
AnnColumnField b a -> a
minimum :: forall a. Ord a => AnnColumnField b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
AnnColumnField b a -> a
sum :: forall a. Num a => AnnColumnField b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
AnnColumnField b a -> a
product :: forall a. Num a => AnnColumnField b a -> a
Foldable, Functor (AnnColumnField b)
Foldable (AnnColumnField b)
Functor (AnnColumnField b)
-> Foldable (AnnColumnField b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> AnnColumnField b a -> f (AnnColumnField b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnColumnField b (f a) -> f (AnnColumnField b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> AnnColumnField b a -> m (AnnColumnField b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnColumnField b (m a) -> m (AnnColumnField b a))
-> Traversable (AnnColumnField b)
forall (b :: BackendType). Backend b => Functor (AnnColumnField b)
forall (b :: BackendType). Backend b => Foldable (AnnColumnField b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
AnnColumnField b (m a) -> m (AnnColumnField b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnColumnField b (f a) -> f (AnnColumnField b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnColumnField b a -> m (AnnColumnField b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AnnColumnField b a -> f (AnnColumnField b b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
AnnColumnField b (m a) -> m (AnnColumnField b a)
forall (f :: * -> *) a.
Applicative f =>
AnnColumnField b (f a) -> f (AnnColumnField b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnColumnField b a -> m (AnnColumnField b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnColumnField b a -> f (AnnColumnField b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AnnColumnField b a -> f (AnnColumnField b b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnColumnField b a -> f (AnnColumnField b b)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnColumnField b (f a) -> f (AnnColumnField b a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
AnnColumnField b (f a) -> f (AnnColumnField b a)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnColumnField b a -> m (AnnColumnField b b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnColumnField b a -> m (AnnColumnField b b)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
AnnColumnField b (m a) -> m (AnnColumnField b a)
sequence :: forall (m :: * -> *) a.
Monad m =>
AnnColumnField b (m a) -> m (AnnColumnField b a)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AnnRedactionExp b v)
  ) =>
  Eq (AnnColumnField b v)

deriving stock instance
  ( Backend b,
    Show (AnnRedactionExp b v)
  ) =>
  Show (AnnColumnField b v)

-- Computed field

data ComputedFieldScalarSelect (b :: BackendType) v = ComputedFieldScalarSelect
  { forall (b :: BackendType) v.
ComputedFieldScalarSelect b v -> FunctionName b
_cfssFunction :: FunctionName b,
    forall (b :: BackendType) v.
ComputedFieldScalarSelect b v -> FunctionArgsExp b v
_cfssArguments :: FunctionArgsExp b v,
    forall (b :: BackendType) v.
ComputedFieldScalarSelect b v -> ScalarType b
_cfssType :: ScalarType b,
    forall (b :: BackendType) v.
ComputedFieldScalarSelect b v -> Maybe (ScalarSelectionArguments b)
_cfssScalarArguments :: (Maybe (ScalarSelectionArguments b)),
    -- | This type is used to determine whether the computed field should be redacted
    forall (b :: BackendType) v.
ComputedFieldScalarSelect b v -> AnnRedactionExp b v
_cfssRedactionExpression :: AnnRedactionExp b v
  }
  deriving stock ((forall a b.
 (a -> b)
 -> ComputedFieldScalarSelect b a -> ComputedFieldScalarSelect b b)
-> (forall a b.
    a
    -> ComputedFieldScalarSelect b b -> ComputedFieldScalarSelect b a)
-> Functor (ComputedFieldScalarSelect b)
forall a b.
a -> ComputedFieldScalarSelect b b -> ComputedFieldScalarSelect b a
forall a b.
(a -> b)
-> ComputedFieldScalarSelect b a -> ComputedFieldScalarSelect b b
forall (b :: BackendType) a b.
Backend b =>
a -> ComputedFieldScalarSelect b b -> ComputedFieldScalarSelect b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b)
-> ComputedFieldScalarSelect b a -> ComputedFieldScalarSelect b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b)
-> ComputedFieldScalarSelect b a -> ComputedFieldScalarSelect b b
fmap :: forall a b.
(a -> b)
-> ComputedFieldScalarSelect b a -> ComputedFieldScalarSelect b b
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> ComputedFieldScalarSelect b b -> ComputedFieldScalarSelect b a
<$ :: forall a b.
a -> ComputedFieldScalarSelect b b -> ComputedFieldScalarSelect b a
Functor, (forall m. Monoid m => ComputedFieldScalarSelect b m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> ComputedFieldScalarSelect b a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> ComputedFieldScalarSelect b a -> m)
-> (forall a b.
    (a -> b -> b) -> b -> ComputedFieldScalarSelect b a -> b)
-> (forall a b.
    (a -> b -> b) -> b -> ComputedFieldScalarSelect b a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> ComputedFieldScalarSelect b a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> ComputedFieldScalarSelect b a -> b)
-> (forall a. (a -> a -> a) -> ComputedFieldScalarSelect b a -> a)
-> (forall a. (a -> a -> a) -> ComputedFieldScalarSelect b a -> a)
-> (forall a. ComputedFieldScalarSelect b a -> [a])
-> (forall a. ComputedFieldScalarSelect b a -> Bool)
-> (forall a. ComputedFieldScalarSelect b a -> Int)
-> (forall a. Eq a => a -> ComputedFieldScalarSelect b a -> Bool)
-> (forall a. Ord a => ComputedFieldScalarSelect b a -> a)
-> (forall a. Ord a => ComputedFieldScalarSelect b a -> a)
-> (forall a. Num a => ComputedFieldScalarSelect b a -> a)
-> (forall a. Num a => ComputedFieldScalarSelect b a -> a)
-> Foldable (ComputedFieldScalarSelect b)
forall a. Eq a => a -> ComputedFieldScalarSelect b a -> Bool
forall a. Num a => ComputedFieldScalarSelect b a -> a
forall a. Ord a => ComputedFieldScalarSelect b a -> a
forall m. Monoid m => ComputedFieldScalarSelect b m -> m
forall a. ComputedFieldScalarSelect b a -> Bool
forall a. ComputedFieldScalarSelect b a -> Int
forall a. ComputedFieldScalarSelect b a -> [a]
forall a. (a -> a -> a) -> ComputedFieldScalarSelect b a -> a
forall m a.
Monoid m =>
(a -> m) -> ComputedFieldScalarSelect b a -> m
forall b a.
(b -> a -> b) -> b -> ComputedFieldScalarSelect b a -> b
forall a b.
(a -> b -> b) -> b -> ComputedFieldScalarSelect b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> ComputedFieldScalarSelect b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
ComputedFieldScalarSelect b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
ComputedFieldScalarSelect b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
ComputedFieldScalarSelect b m -> m
forall (b :: BackendType) a.
Backend b =>
ComputedFieldScalarSelect b a -> Bool
forall (b :: BackendType) a.
Backend b =>
ComputedFieldScalarSelect b a -> Int
forall (b :: BackendType) a.
Backend b =>
ComputedFieldScalarSelect b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ComputedFieldScalarSelect b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ComputedFieldScalarSelect b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ComputedFieldScalarSelect b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ComputedFieldScalarSelect b a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
ComputedFieldScalarSelect b m -> m
fold :: forall m. Monoid m => ComputedFieldScalarSelect b m -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ComputedFieldScalarSelect b a -> m
foldMap :: forall m a.
Monoid m =>
(a -> m) -> ComputedFieldScalarSelect b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ComputedFieldScalarSelect b a -> m
foldMap' :: forall m a.
Monoid m =>
(a -> m) -> ComputedFieldScalarSelect b a -> m
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ComputedFieldScalarSelect b a -> b
foldr :: forall a b.
(a -> b -> b) -> b -> ComputedFieldScalarSelect b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ComputedFieldScalarSelect b a -> b
foldr' :: forall a b.
(a -> b -> b) -> b -> ComputedFieldScalarSelect b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ComputedFieldScalarSelect b a -> b
foldl :: forall b a.
(b -> a -> b) -> b -> ComputedFieldScalarSelect b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ComputedFieldScalarSelect b a -> b
foldl' :: forall b a.
(b -> a -> b) -> b -> ComputedFieldScalarSelect b a -> b
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ComputedFieldScalarSelect b a -> a
foldr1 :: forall a. (a -> a -> a) -> ComputedFieldScalarSelect b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ComputedFieldScalarSelect b a -> a
foldl1 :: forall a. (a -> a -> a) -> ComputedFieldScalarSelect b a -> a
$ctoList :: forall (b :: BackendType) a.
Backend b =>
ComputedFieldScalarSelect b a -> [a]
toList :: forall a. ComputedFieldScalarSelect b a -> [a]
$cnull :: forall (b :: BackendType) a.
Backend b =>
ComputedFieldScalarSelect b a -> Bool
null :: forall a. ComputedFieldScalarSelect b a -> Bool
$clength :: forall (b :: BackendType) a.
Backend b =>
ComputedFieldScalarSelect b a -> Int
length :: forall a. ComputedFieldScalarSelect b a -> Int
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> ComputedFieldScalarSelect b a -> Bool
elem :: forall a. Eq a => a -> ComputedFieldScalarSelect b a -> Bool
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
ComputedFieldScalarSelect b a -> a
maximum :: forall a. Ord a => ComputedFieldScalarSelect b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
ComputedFieldScalarSelect b a -> a
minimum :: forall a. Ord a => ComputedFieldScalarSelect b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
ComputedFieldScalarSelect b a -> a
sum :: forall a. Num a => ComputedFieldScalarSelect b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
ComputedFieldScalarSelect b a -> a
product :: forall a. Num a => ComputedFieldScalarSelect b a -> a
Foldable, Functor (ComputedFieldScalarSelect b)
Foldable (ComputedFieldScalarSelect b)
Functor (ComputedFieldScalarSelect b)
-> Foldable (ComputedFieldScalarSelect b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b)
    -> ComputedFieldScalarSelect b a
    -> f (ComputedFieldScalarSelect b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    ComputedFieldScalarSelect b (f a)
    -> f (ComputedFieldScalarSelect b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b)
    -> ComputedFieldScalarSelect b a
    -> m (ComputedFieldScalarSelect b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    ComputedFieldScalarSelect b (m a)
    -> m (ComputedFieldScalarSelect b a))
-> Traversable (ComputedFieldScalarSelect b)
forall (b :: BackendType).
Backend b =>
Functor (ComputedFieldScalarSelect b)
forall (b :: BackendType).
Backend b =>
Foldable (ComputedFieldScalarSelect b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
ComputedFieldScalarSelect b (m a)
-> m (ComputedFieldScalarSelect b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
ComputedFieldScalarSelect b (f a)
-> f (ComputedFieldScalarSelect b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> ComputedFieldScalarSelect b a
-> m (ComputedFieldScalarSelect b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> ComputedFieldScalarSelect b a
-> f (ComputedFieldScalarSelect b b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
ComputedFieldScalarSelect b (m a)
-> m (ComputedFieldScalarSelect b a)
forall (f :: * -> *) a.
Applicative f =>
ComputedFieldScalarSelect b (f a)
-> f (ComputedFieldScalarSelect b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> ComputedFieldScalarSelect b a
-> m (ComputedFieldScalarSelect b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> ComputedFieldScalarSelect b a
-> f (ComputedFieldScalarSelect b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> ComputedFieldScalarSelect b a
-> f (ComputedFieldScalarSelect b b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> ComputedFieldScalarSelect b a
-> f (ComputedFieldScalarSelect b b)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
ComputedFieldScalarSelect b (f a)
-> f (ComputedFieldScalarSelect b a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ComputedFieldScalarSelect b (f a)
-> f (ComputedFieldScalarSelect b a)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> ComputedFieldScalarSelect b a
-> m (ComputedFieldScalarSelect b b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> ComputedFieldScalarSelect b a
-> m (ComputedFieldScalarSelect b b)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
ComputedFieldScalarSelect b (m a)
-> m (ComputedFieldScalarSelect b a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ComputedFieldScalarSelect b (m a)
-> m (ComputedFieldScalarSelect b a)
Traversable)

deriving stock instance
  ( Backend b,
    Show v,
    Show (FunctionArgumentExp b v),
    Show (AnnRedactionExp b v)
  ) =>
  Show (ComputedFieldScalarSelect b v)

deriving stock instance
  ( Backend b,
    Eq v,
    Eq (FunctionArgumentExp b v),
    Eq (AnnRedactionExp b v)
  ) =>
  Eq (ComputedFieldScalarSelect b v)

data ComputedFieldSelect (b :: BackendType) (r :: Type) v
  = CFSScalar
      -- | Type containing info about the computed field
      (ComputedFieldScalarSelect b v)
  | CFSTable JsonAggSelect (AnnSimpleSelectG b r v)
  deriving stock ((forall a b.
 (a -> b) -> ComputedFieldSelect b r a -> ComputedFieldSelect b r b)
-> (forall a b.
    a -> ComputedFieldSelect b r b -> ComputedFieldSelect b r a)
-> Functor (ComputedFieldSelect b r)
forall a b.
a -> ComputedFieldSelect b r b -> ComputedFieldSelect b r a
forall a b.
(a -> b) -> ComputedFieldSelect b r a -> ComputedFieldSelect b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> ComputedFieldSelect b r b -> ComputedFieldSelect b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ComputedFieldSelect b r a -> ComputedFieldSelect b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ComputedFieldSelect b r a -> ComputedFieldSelect b r b
fmap :: forall a b.
(a -> b) -> ComputedFieldSelect b r a -> ComputedFieldSelect b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> ComputedFieldSelect b r b -> ComputedFieldSelect b r a
<$ :: forall a b.
a -> ComputedFieldSelect b r b -> ComputedFieldSelect b r a
Functor, (forall m. Monoid m => ComputedFieldSelect b r m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> ComputedFieldSelect b r a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> ComputedFieldSelect b r a -> m)
-> (forall a b.
    (a -> b -> b) -> b -> ComputedFieldSelect b r a -> b)
-> (forall a b.
    (a -> b -> b) -> b -> ComputedFieldSelect b r a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> ComputedFieldSelect b r a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> ComputedFieldSelect b r a -> b)
-> (forall a. (a -> a -> a) -> ComputedFieldSelect b r a -> a)
-> (forall a. (a -> a -> a) -> ComputedFieldSelect b r a -> a)
-> (forall a. ComputedFieldSelect b r a -> [a])
-> (forall a. ComputedFieldSelect b r a -> Bool)
-> (forall a. ComputedFieldSelect b r a -> Int)
-> (forall a. Eq a => a -> ComputedFieldSelect b r a -> Bool)
-> (forall a. Ord a => ComputedFieldSelect b r a -> a)
-> (forall a. Ord a => ComputedFieldSelect b r a -> a)
-> (forall a. Num a => ComputedFieldSelect b r a -> a)
-> (forall a. Num a => ComputedFieldSelect b r a -> a)
-> Foldable (ComputedFieldSelect b r)
forall a. Eq a => a -> ComputedFieldSelect b r a -> Bool
forall a. Num a => ComputedFieldSelect b r a -> a
forall a. Ord a => ComputedFieldSelect b r a -> a
forall m. Monoid m => ComputedFieldSelect b r m -> m
forall a. ComputedFieldSelect b r a -> Bool
forall a. ComputedFieldSelect b r a -> Int
forall a. ComputedFieldSelect b r a -> [a]
forall a. (a -> a -> a) -> ComputedFieldSelect b r a -> a
forall m a. Monoid m => (a -> m) -> ComputedFieldSelect b r a -> m
forall b a. (b -> a -> b) -> b -> ComputedFieldSelect b r a -> b
forall a b. (a -> b -> b) -> b -> ComputedFieldSelect b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ComputedFieldSelect b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
ComputedFieldSelect b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ComputedFieldSelect b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ComputedFieldSelect b r m -> m
forall (b :: BackendType) r a.
Backend b =>
ComputedFieldSelect b r a -> Bool
forall (b :: BackendType) r a.
Backend b =>
ComputedFieldSelect b r a -> Int
forall (b :: BackendType) r a.
Backend b =>
ComputedFieldSelect b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ComputedFieldSelect b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ComputedFieldSelect b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ComputedFieldSelect b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ComputedFieldSelect b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ComputedFieldSelect b r m -> m
fold :: forall m. Monoid m => ComputedFieldSelect b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ComputedFieldSelect b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ComputedFieldSelect b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ComputedFieldSelect b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ComputedFieldSelect b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ComputedFieldSelect b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ComputedFieldSelect b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ComputedFieldSelect b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ComputedFieldSelect b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ComputedFieldSelect b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ComputedFieldSelect b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ComputedFieldSelect b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ComputedFieldSelect b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ComputedFieldSelect b r a -> a
foldr1 :: forall a. (a -> a -> a) -> ComputedFieldSelect b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ComputedFieldSelect b r a -> a
foldl1 :: forall a. (a -> a -> a) -> ComputedFieldSelect b r a -> a
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
ComputedFieldSelect b r a -> [a]
toList :: forall a. ComputedFieldSelect b r a -> [a]
$cnull :: forall (b :: BackendType) r a.
Backend b =>
ComputedFieldSelect b r a -> Bool
null :: forall a. ComputedFieldSelect b r a -> Bool
$clength :: forall (b :: BackendType) r a.
Backend b =>
ComputedFieldSelect b r a -> Int
length :: forall a. ComputedFieldSelect b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ComputedFieldSelect b r a -> Bool
elem :: forall a. Eq a => a -> ComputedFieldSelect b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ComputedFieldSelect b r a -> a
maximum :: forall a. Ord a => ComputedFieldSelect b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ComputedFieldSelect b r a -> a
minimum :: forall a. Ord a => ComputedFieldSelect b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ComputedFieldSelect b r a -> a
sum :: forall a. Num a => ComputedFieldSelect b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ComputedFieldSelect b r a -> a
product :: forall a. Num a => ComputedFieldSelect b r a -> a
Foldable, Functor (ComputedFieldSelect b r)
Foldable (ComputedFieldSelect b r)
Functor (ComputedFieldSelect b r)
-> Foldable (ComputedFieldSelect b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b)
    -> ComputedFieldSelect b r a -> f (ComputedFieldSelect b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    ComputedFieldSelect b r (f a) -> f (ComputedFieldSelect b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b)
    -> ComputedFieldSelect b r a -> m (ComputedFieldSelect b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    ComputedFieldSelect b r (m a) -> m (ComputedFieldSelect b r a))
-> Traversable (ComputedFieldSelect b r)
forall (b :: BackendType) r.
Backend b =>
Functor (ComputedFieldSelect b r)
forall (b :: BackendType) r.
Backend b =>
Foldable (ComputedFieldSelect b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ComputedFieldSelect b r (m a) -> m (ComputedFieldSelect b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ComputedFieldSelect b r (f a) -> f (ComputedFieldSelect b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> ComputedFieldSelect b r a -> m (ComputedFieldSelect b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> ComputedFieldSelect b r a -> f (ComputedFieldSelect b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
ComputedFieldSelect b r (m a) -> m (ComputedFieldSelect b r a)
forall (f :: * -> *) a.
Applicative f =>
ComputedFieldSelect b r (f a) -> f (ComputedFieldSelect b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> ComputedFieldSelect b r a -> m (ComputedFieldSelect b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> ComputedFieldSelect b r a -> f (ComputedFieldSelect b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> ComputedFieldSelect b r a -> f (ComputedFieldSelect b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> ComputedFieldSelect b r a -> f (ComputedFieldSelect b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ComputedFieldSelect b r (f a) -> f (ComputedFieldSelect b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ComputedFieldSelect b r (f a) -> f (ComputedFieldSelect b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> ComputedFieldSelect b r a -> m (ComputedFieldSelect b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> ComputedFieldSelect b r a -> m (ComputedFieldSelect b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ComputedFieldSelect b r (m a) -> m (ComputedFieldSelect b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ComputedFieldSelect b r (m a) -> m (ComputedFieldSelect b r a)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AnnSimpleSelectG b r v),
    Eq (ComputedFieldScalarSelect b v)
  ) =>
  Eq (ComputedFieldSelect b r v)

deriving stock instance
  ( Backend b,
    Show (AnnSimpleSelectG b r v),
    Show (ComputedFieldScalarSelect b v)
  ) =>
  Show (ComputedFieldSelect b r v)

instance (Backend b) => Bifoldable (ComputedFieldSelect b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> ComputedFieldSelect b a b -> m
bifoldMap a -> m
f b -> m
g = \case
    CFSScalar ComputedFieldScalarSelect b b
cfsSelect -> (b -> m) -> ComputedFieldScalarSelect b b -> m
forall m a.
Monoid m =>
(a -> m) -> ComputedFieldScalarSelect b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap b -> m
g ComputedFieldScalarSelect b b
cfsSelect
    CFSTable JsonAggSelect
_ AnnSimpleSelectG b a b
simpleSelect -> (a -> m) -> (b -> m) -> AnnSimpleSelectG b a b -> m
forall (b :: BackendType) (f :: BackendType -> * -> * -> *) m r v.
(Backend b, Bifoldable (f b), Monoid m) =>
(r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG a -> m
f b -> m
g AnnSimpleSelectG b a b
simpleSelect

-- Local relationship

type ArrayRelationSelectG b r v = AnnRelationSelectG b (AnnSimpleSelectG b r v)

type ArrayAggregateSelectG b r v = AnnRelationSelectG b (AnnAggregateSelectG b r v)

type ArrayConnectionSelect b r v = AnnRelationSelectG b (ConnectionSelect b r v)

type ArrayAggregateSelect b = ArrayAggregateSelectG b Void (SQLExpression b)

data AnnObjectSelectG (b :: BackendType) (r :: Type) v = AnnObjectSelectG
  { forall (b :: BackendType) r v.
AnnObjectSelectG b r v -> AnnFieldsG b r v
_aosFields :: AnnFieldsG b r v,
    forall (b :: BackendType) r v.
AnnObjectSelectG b r v -> SelectFromG b v
_aosTarget :: SelectFromG b v,
    forall (b :: BackendType) r v.
AnnObjectSelectG b r v -> AnnBoolExp b v
_aosTargetFilter :: (AnnBoolExp b v)
  }
  deriving stock ((forall a b.
 (a -> b) -> AnnObjectSelectG b r a -> AnnObjectSelectG b r b)
-> (forall a b.
    a -> AnnObjectSelectG b r b -> AnnObjectSelectG b r a)
-> Functor (AnnObjectSelectG b r)
forall a b. a -> AnnObjectSelectG b r b -> AnnObjectSelectG b r a
forall a b.
(a -> b) -> AnnObjectSelectG b r a -> AnnObjectSelectG b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> AnnObjectSelectG b r b -> AnnObjectSelectG b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> AnnObjectSelectG b r a -> AnnObjectSelectG b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> AnnObjectSelectG b r a -> AnnObjectSelectG b r b
fmap :: forall a b.
(a -> b) -> AnnObjectSelectG b r a -> AnnObjectSelectG b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> AnnObjectSelectG b r b -> AnnObjectSelectG b r a
<$ :: forall a b. a -> AnnObjectSelectG b r b -> AnnObjectSelectG b r a
Functor, (forall m. Monoid m => AnnObjectSelectG b r m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnObjectSelectG b r a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnObjectSelectG b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> AnnObjectSelectG b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> AnnObjectSelectG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnObjectSelectG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnObjectSelectG b r a -> b)
-> (forall a. (a -> a -> a) -> AnnObjectSelectG b r a -> a)
-> (forall a. (a -> a -> a) -> AnnObjectSelectG b r a -> a)
-> (forall a. AnnObjectSelectG b r a -> [a])
-> (forall a. AnnObjectSelectG b r a -> Bool)
-> (forall a. AnnObjectSelectG b r a -> Int)
-> (forall a. Eq a => a -> AnnObjectSelectG b r a -> Bool)
-> (forall a. Ord a => AnnObjectSelectG b r a -> a)
-> (forall a. Ord a => AnnObjectSelectG b r a -> a)
-> (forall a. Num a => AnnObjectSelectG b r a -> a)
-> (forall a. Num a => AnnObjectSelectG b r a -> a)
-> Foldable (AnnObjectSelectG b r)
forall a. Eq a => a -> AnnObjectSelectG b r a -> Bool
forall a. Num a => AnnObjectSelectG b r a -> a
forall a. Ord a => AnnObjectSelectG b r a -> a
forall m. Monoid m => AnnObjectSelectG b r m -> m
forall a. AnnObjectSelectG b r a -> Bool
forall a. AnnObjectSelectG b r a -> Int
forall a. AnnObjectSelectG b r a -> [a]
forall a. (a -> a -> a) -> AnnObjectSelectG b r a -> a
forall m a. Monoid m => (a -> m) -> AnnObjectSelectG b r a -> m
forall b a. (b -> a -> b) -> b -> AnnObjectSelectG b r a -> b
forall a b. (a -> b -> b) -> b -> AnnObjectSelectG b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnObjectSelectG b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnObjectSelectG b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnObjectSelectG b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnObjectSelectG b r m -> m
forall (b :: BackendType) r a.
Backend b =>
AnnObjectSelectG b r a -> Bool
forall (b :: BackendType) r a.
Backend b =>
AnnObjectSelectG b r a -> Int
forall (b :: BackendType) r a.
Backend b =>
AnnObjectSelectG b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnObjectSelectG b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnObjectSelectG b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnObjectSelectG b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnObjectSelectG b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnObjectSelectG b r m -> m
fold :: forall m. Monoid m => AnnObjectSelectG b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnObjectSelectG b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> AnnObjectSelectG b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnObjectSelectG b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> AnnObjectSelectG b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnObjectSelectG b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> AnnObjectSelectG b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnObjectSelectG b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> AnnObjectSelectG b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnObjectSelectG b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> AnnObjectSelectG b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnObjectSelectG b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> AnnObjectSelectG b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnObjectSelectG b r a -> a
foldr1 :: forall a. (a -> a -> a) -> AnnObjectSelectG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnObjectSelectG b r a -> a
foldl1 :: forall a. (a -> a -> a) -> AnnObjectSelectG b r a -> a
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
AnnObjectSelectG b r a -> [a]
toList :: forall a. AnnObjectSelectG b r a -> [a]
$cnull :: forall (b :: BackendType) r a.
Backend b =>
AnnObjectSelectG b r a -> Bool
null :: forall a. AnnObjectSelectG b r a -> Bool
$clength :: forall (b :: BackendType) r a.
Backend b =>
AnnObjectSelectG b r a -> Int
length :: forall a. AnnObjectSelectG b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnObjectSelectG b r a -> Bool
elem :: forall a. Eq a => a -> AnnObjectSelectG b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnObjectSelectG b r a -> a
maximum :: forall a. Ord a => AnnObjectSelectG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnObjectSelectG b r a -> a
minimum :: forall a. Ord a => AnnObjectSelectG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnObjectSelectG b r a -> a
sum :: forall a. Num a => AnnObjectSelectG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnObjectSelectG b r a -> a
product :: forall a. Num a => AnnObjectSelectG b r a -> a
Foldable, Functor (AnnObjectSelectG b r)
Foldable (AnnObjectSelectG b r)
Functor (AnnObjectSelectG b r)
-> Foldable (AnnObjectSelectG b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> AnnObjectSelectG b r a -> f (AnnObjectSelectG b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnObjectSelectG b r (f a) -> f (AnnObjectSelectG b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> AnnObjectSelectG b r a -> m (AnnObjectSelectG b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnObjectSelectG b r (m a) -> m (AnnObjectSelectG b r a))
-> Traversable (AnnObjectSelectG b r)
forall (b :: BackendType) r.
Backend b =>
Functor (AnnObjectSelectG b r)
forall (b :: BackendType) r.
Backend b =>
Foldable (AnnObjectSelectG b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnObjectSelectG b r (m a) -> m (AnnObjectSelectG b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnObjectSelectG b r (f a) -> f (AnnObjectSelectG b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnObjectSelectG b r a -> m (AnnObjectSelectG b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AnnObjectSelectG b r a -> f (AnnObjectSelectG b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
AnnObjectSelectG b r (m a) -> m (AnnObjectSelectG b r a)
forall (f :: * -> *) a.
Applicative f =>
AnnObjectSelectG b r (f a) -> f (AnnObjectSelectG b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnObjectSelectG b r a -> m (AnnObjectSelectG b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnObjectSelectG b r a -> f (AnnObjectSelectG b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AnnObjectSelectG b r a -> f (AnnObjectSelectG b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnObjectSelectG b r a -> f (AnnObjectSelectG b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnObjectSelectG b r (f a) -> f (AnnObjectSelectG b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
AnnObjectSelectG b r (f a) -> f (AnnObjectSelectG b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnObjectSelectG b r a -> m (AnnObjectSelectG b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnObjectSelectG b r a -> m (AnnObjectSelectG b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnObjectSelectG b r (m a) -> m (AnnObjectSelectG b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
AnnObjectSelectG b r (m a) -> m (AnnObjectSelectG b r a)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (SelectFromG b v),
    Eq (AnnBoolExp b v),
    Eq (AnnFieldsG b r v)
  ) =>
  Eq (AnnObjectSelectG b r v)

deriving stock instance
  ( Backend b,
    Show (SelectFromG b v),
    Show (AnnBoolExp b v),
    Show (AnnFieldsG b r v)
  ) =>
  Show (AnnObjectSelectG b r v)

instance (Backend b) => Bifoldable (AnnObjectSelectG b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnObjectSelectG b a b -> m
bifoldMap a -> m
f b -> m
g AnnObjectSelectG {AnnFieldsG b a b
AnnBoolExp b b
SelectFromG b b
$sel:_aosFields:AnnObjectSelectG :: forall (b :: BackendType) r v.
AnnObjectSelectG b r v -> AnnFieldsG b r v
$sel:_aosTarget:AnnObjectSelectG :: forall (b :: BackendType) r v.
AnnObjectSelectG b r v -> SelectFromG b v
$sel:_aosTargetFilter:AnnObjectSelectG :: forall (b :: BackendType) r v.
AnnObjectSelectG b r v -> AnnBoolExp b v
_aosFields :: AnnFieldsG b a b
_aosTarget :: SelectFromG b b
_aosTargetFilter :: AnnBoolExp b b
..} =
    ((FieldName, AnnFieldG b a b) -> m) -> AnnFieldsG b a b -> m
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b a b -> m) -> (FieldName, AnnFieldG b a b) -> m
forall m a. Monoid m => (a -> m) -> (FieldName, a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b a b -> m) -> (FieldName, AnnFieldG b a b) -> m)
-> (AnnFieldG b a b -> m) -> (FieldName, AnnFieldG b a b) -> m
forall a b. (a -> b) -> a -> b
$ (a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g) AnnFieldsG b a b
_aosFields m -> m -> m
forall a. Semigroup a => a -> a -> a
<> (AnnBoolExpFld b b -> m) -> AnnBoolExp b b -> m
forall m a. Monoid m => (a -> m) -> GBoolExp b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((b -> m) -> AnnBoolExpFld b b -> m
forall m a. Monoid m => (a -> m) -> AnnBoolExpFld b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap b -> m
g) AnnBoolExp b b
_aosTargetFilter

type AnnObjectSelect b r = AnnObjectSelectG b r (SQLExpression b)

type ObjectRelationSelectG b r v = AnnRelationSelectG b (AnnObjectSelectG b r v)

type ObjectRelationSelect b = ObjectRelationSelectG b Void (SQLExpression b)

data ArraySelectG (b :: BackendType) (r :: Type) v
  = ASSimple (ArrayRelationSelectG b r v)
  | ASAggregate (ArrayAggregateSelectG b r v)
  | ASConnection (ArrayConnectionSelect b r v)
  deriving stock ((forall a b. (a -> b) -> ArraySelectG b r a -> ArraySelectG b r b)
-> (forall a b. a -> ArraySelectG b r b -> ArraySelectG b r a)
-> Functor (ArraySelectG b r)
forall a b. a -> ArraySelectG b r b -> ArraySelectG b r a
forall a b. (a -> b) -> ArraySelectG b r a -> ArraySelectG b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> ArraySelectG b r b -> ArraySelectG b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ArraySelectG b r a -> ArraySelectG b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ArraySelectG b r a -> ArraySelectG b r b
fmap :: forall a b. (a -> b) -> ArraySelectG b r a -> ArraySelectG b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> ArraySelectG b r b -> ArraySelectG b r a
<$ :: forall a b. a -> ArraySelectG b r b -> ArraySelectG b r a
Functor, (forall m. Monoid m => ArraySelectG b r m -> m)
-> (forall m a. Monoid m => (a -> m) -> ArraySelectG b r a -> m)
-> (forall m a. Monoid m => (a -> m) -> ArraySelectG b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> ArraySelectG b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> ArraySelectG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> ArraySelectG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> ArraySelectG b r a -> b)
-> (forall a. (a -> a -> a) -> ArraySelectG b r a -> a)
-> (forall a. (a -> a -> a) -> ArraySelectG b r a -> a)
-> (forall a. ArraySelectG b r a -> [a])
-> (forall a. ArraySelectG b r a -> Bool)
-> (forall a. ArraySelectG b r a -> Int)
-> (forall a. Eq a => a -> ArraySelectG b r a -> Bool)
-> (forall a. Ord a => ArraySelectG b r a -> a)
-> (forall a. Ord a => ArraySelectG b r a -> a)
-> (forall a. Num a => ArraySelectG b r a -> a)
-> (forall a. Num a => ArraySelectG b r a -> a)
-> Foldable (ArraySelectG b r)
forall a. Eq a => a -> ArraySelectG b r a -> Bool
forall a. Num a => ArraySelectG b r a -> a
forall a. Ord a => ArraySelectG b r a -> a
forall m. Monoid m => ArraySelectG b r m -> m
forall a. ArraySelectG b r a -> Bool
forall a. ArraySelectG b r a -> Int
forall a. ArraySelectG b r a -> [a]
forall a. (a -> a -> a) -> ArraySelectG b r a -> a
forall m a. Monoid m => (a -> m) -> ArraySelectG b r a -> m
forall b a. (b -> a -> b) -> b -> ArraySelectG b r a -> b
forall a b. (a -> b -> b) -> b -> ArraySelectG b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ArraySelectG b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
ArraySelectG b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ArraySelectG b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ArraySelectG b r m -> m
forall (b :: BackendType) r a.
Backend b =>
ArraySelectG b r a -> Bool
forall (b :: BackendType) r a.
Backend b =>
ArraySelectG b r a -> Int
forall (b :: BackendType) r a.
Backend b =>
ArraySelectG b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ArraySelectG b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ArraySelectG b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ArraySelectG b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ArraySelectG b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ArraySelectG b r m -> m
fold :: forall m. Monoid m => ArraySelectG b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ArraySelectG b r a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ArraySelectG b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> ArraySelectG b r a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ArraySelectG b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ArraySelectG b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ArraySelectG b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> ArraySelectG b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ArraySelectG b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ArraySelectG b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ArraySelectG b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> ArraySelectG b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ArraySelectG b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ArraySelectG b r a -> a
foldr1 :: forall a. (a -> a -> a) -> ArraySelectG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ArraySelectG b r a -> a
foldl1 :: forall a. (a -> a -> a) -> ArraySelectG b r a -> a
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
ArraySelectG b r a -> [a]
toList :: forall a. ArraySelectG b r a -> [a]
$cnull :: forall (b :: BackendType) r a.
Backend b =>
ArraySelectG b r a -> Bool
null :: forall a. ArraySelectG b r a -> Bool
$clength :: forall (b :: BackendType) r a.
Backend b =>
ArraySelectG b r a -> Int
length :: forall a. ArraySelectG b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ArraySelectG b r a -> Bool
elem :: forall a. Eq a => a -> ArraySelectG b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ArraySelectG b r a -> a
maximum :: forall a. Ord a => ArraySelectG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ArraySelectG b r a -> a
minimum :: forall a. Ord a => ArraySelectG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ArraySelectG b r a -> a
sum :: forall a. Num a => ArraySelectG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ArraySelectG b r a -> a
product :: forall a. Num a => ArraySelectG b r a -> a
Foldable, Functor (ArraySelectG b r)
Foldable (ArraySelectG b r)
Functor (ArraySelectG b r)
-> Foldable (ArraySelectG b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> ArraySelectG b r a -> f (ArraySelectG b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    ArraySelectG b r (f a) -> f (ArraySelectG b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> ArraySelectG b r a -> m (ArraySelectG b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    ArraySelectG b r (m a) -> m (ArraySelectG b r a))
-> Traversable (ArraySelectG b r)
forall (b :: BackendType) r.
Backend b =>
Functor (ArraySelectG b r)
forall (b :: BackendType) r.
Backend b =>
Foldable (ArraySelectG b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ArraySelectG b r (m a) -> m (ArraySelectG b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ArraySelectG b r (f a) -> f (ArraySelectG b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ArraySelectG b r a -> m (ArraySelectG b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> ArraySelectG b r a -> f (ArraySelectG b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
ArraySelectG b r (m a) -> m (ArraySelectG b r a)
forall (f :: * -> *) a.
Applicative f =>
ArraySelectG b r (f a) -> f (ArraySelectG b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ArraySelectG b r a -> m (ArraySelectG b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ArraySelectG b r a -> f (ArraySelectG b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> ArraySelectG b r a -> f (ArraySelectG b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ArraySelectG b r a -> f (ArraySelectG b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ArraySelectG b r (f a) -> f (ArraySelectG b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ArraySelectG b r (f a) -> f (ArraySelectG b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ArraySelectG b r a -> m (ArraySelectG b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ArraySelectG b r a -> m (ArraySelectG b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ArraySelectG b r (m a) -> m (ArraySelectG b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ArraySelectG b r (m a) -> m (ArraySelectG b r a)
Traversable)

deriving stock instance
  ( Eq (ArrayRelationSelectG b r v),
    Eq (ArrayAggregateSelectG b r v),
    Eq (ArrayConnectionSelect b r v)
  ) =>
  Eq (ArraySelectG b r v)

deriving stock instance
  ( Show (ArrayRelationSelectG b r v),
    Show (ArrayAggregateSelectG b r v),
    Show (ArrayConnectionSelect b r v)
  ) =>
  Show (ArraySelectG b r v)

instance (Backend b) => Bifoldable (ArraySelectG b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> ArraySelectG b a b -> m
bifoldMap a -> m
f b -> m
g = \case
    ASSimple ArrayRelationSelectG b a b
arrayRelationSelect -> (AnnSelectG b (AnnFieldG b a) b -> m)
-> ArrayRelationSelectG b a b -> m
forall m a. Monoid m => (a -> m) -> AnnRelationSelectG b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((a -> m) -> (b -> m) -> AnnSelectG b (AnnFieldG b a) b -> m
forall (b :: BackendType) (f :: BackendType -> * -> * -> *) m r v.
(Backend b, Bifoldable (f b), Monoid m) =>
(r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG a -> m
f b -> m
g) ArrayRelationSelectG b a b
arrayRelationSelect
    ASAggregate ArrayAggregateSelectG b a b
arrayAggregateSelect -> (AnnSelectG b (TableAggregateFieldG b a) b -> m)
-> ArrayAggregateSelectG b a b -> m
forall m a. Monoid m => (a -> m) -> AnnRelationSelectG b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((a -> m)
-> (b -> m) -> AnnSelectG b (TableAggregateFieldG b a) b -> m
forall (b :: BackendType) (f :: BackendType -> * -> * -> *) m r v.
(Backend b, Bifoldable (f b), Monoid m) =>
(r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG a -> m
f b -> m
g) ArrayAggregateSelectG b a b
arrayAggregateSelect
    ASConnection ArrayConnectionSelect b a b
arrayConnectionSelect -> (ConnectionSelect b a b -> m) -> ArrayConnectionSelect b a b -> m
forall m a. Monoid m => (a -> m) -> AnnRelationSelectG b a -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((a -> m) -> (b -> m) -> ConnectionSelect b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> ConnectionSelect b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g) ArrayConnectionSelect b a b
arrayConnectionSelect

type ArraySelect b = ArraySelectG b Void (SQLExpression b)

type ArraySelectFieldsG b r v = Fields (ArraySelectG b r v)

-- | Captures the selection set of a remote source relationship.
data
  SourceRelationshipSelection
    (b :: BackendType)
    (r :: Type)
    (vf :: BackendType -> Type)
  = SourceRelationshipObject (AnnObjectSelectG b r (vf b))
  | SourceRelationshipArray (AnnSimpleSelectG b r (vf b))
  | SourceRelationshipArrayAggregate (AnnAggregateSelectG b r (vf b))

deriving stock instance
  ( Backend b,
    Eq (AnnAggregateSelectG b r (vf b)),
    Eq (AnnObjectSelectG b r (vf b)),
    Eq (AnnSimpleSelectG b r (vf b))
  ) =>
  Eq (SourceRelationshipSelection b r vf)

deriving stock instance
  ( Backend b,
    Show (AnnAggregateSelectG b r (vf b)),
    Show (AnnObjectSelectG b r (vf b)),
    Show (AnnSimpleSelectG b r (vf b))
  ) =>
  Show (SourceRelationshipSelection b r vf)

-- | A relationship to a remote source. 'vf' (could use a better name) is
-- analogous to 'v' in other IR types such as 'AnnFieldG'. vf's kind is
-- (BackendType -> Type) instead of v's 'Type' so that 'v' of 'AnnFieldG' can
-- be specific to the backend that it captures ('b' of an AnnFieldG changes as
-- we walk down the IR branches which capture relationships to other databases)
data
  RemoteSourceSelect
    (r :: Type)
    (vf :: BackendType -> Type)
    (tgt :: BackendType) = RemoteSourceSelect
  { forall r (vf :: BackendType -> *) (tgt :: BackendType).
RemoteSourceSelect r vf tgt -> SourceName
_rssName :: SourceName,
    forall r (vf :: BackendType -> *) (tgt :: BackendType).
RemoteSourceSelect r vf tgt -> SourceConfig tgt
_rssConfig :: SourceConfig tgt,
    forall r (vf :: BackendType -> *) (tgt :: BackendType).
RemoteSourceSelect r vf tgt -> SourceRelationshipSelection tgt r vf
_rssSelection :: SourceRelationshipSelection tgt r vf,
    -- | Additional information about the source's join columns:
    -- (ScalarType tgt) so that the remote can interpret the join values coming
    -- from src
    -- (Column tgt) so that an appropriate join condition / IN clause can be built
    -- by the remote
    forall r (vf :: BackendType -> *) (tgt :: BackendType).
RemoteSourceSelect r vf tgt
-> HashMap FieldName (ScalarType tgt, Column tgt)
_rssJoinMapping :: (HashMap.HashMap FieldName (ScalarType tgt, Column tgt)),
    forall r (vf :: BackendType -> *) (tgt :: BackendType).
RemoteSourceSelect r vf tgt -> StringifyNumbers
_rssStringifyNums :: StringifyNumbers
  }

deriving stock instance
  ( Backend tgt,
    Eq (SourceRelationshipSelection tgt r vf)
  ) =>
  Eq (RemoteSourceSelect r vf tgt)

deriving stock instance
  ( Backend tgt,
    Show (SourceRelationshipSelection tgt r vf),
    Show (SourceConfig tgt)
  ) =>
  Show (RemoteSourceSelect r vf tgt)

-- Nested objects

data AnnNestedObjectSelectG (b :: BackendType) (r :: Type) v = AnnNestedObjectSelectG
  { forall (b :: BackendType) r v.
AnnNestedObjectSelectG b r v -> XNestedObjects b
_anosSupportsNestedObjects :: XNestedObjects b,
    forall (b :: BackendType) r v.
AnnNestedObjectSelectG b r v -> Column b
_anosColumn :: Column b,
    forall (b :: BackendType) r v.
AnnNestedObjectSelectG b r v -> AnnFieldsG b r v
_anosFields :: AnnFieldsG b r v
  }
  deriving stock ((forall a b.
 (a -> b)
 -> AnnNestedObjectSelectG b r a -> AnnNestedObjectSelectG b r b)
-> (forall a b.
    a -> AnnNestedObjectSelectG b r b -> AnnNestedObjectSelectG b r a)
-> Functor (AnnNestedObjectSelectG b r)
forall a b.
a -> AnnNestedObjectSelectG b r b -> AnnNestedObjectSelectG b r a
forall a b.
(a -> b)
-> AnnNestedObjectSelectG b r a -> AnnNestedObjectSelectG b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> AnnNestedObjectSelectG b r b -> AnnNestedObjectSelectG b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b)
-> AnnNestedObjectSelectG b r a -> AnnNestedObjectSelectG b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b)
-> AnnNestedObjectSelectG b r a -> AnnNestedObjectSelectG b r b
fmap :: forall a b.
(a -> b)
-> AnnNestedObjectSelectG b r a -> AnnNestedObjectSelectG b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> AnnNestedObjectSelectG b r b -> AnnNestedObjectSelectG b r a
<$ :: forall a b.
a -> AnnNestedObjectSelectG b r b -> AnnNestedObjectSelectG b r a
Functor, (forall m. Monoid m => AnnNestedObjectSelectG b r m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnNestedObjectSelectG b r a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnNestedObjectSelectG b r a -> m)
-> (forall a b.
    (a -> b -> b) -> b -> AnnNestedObjectSelectG b r a -> b)
-> (forall a b.
    (a -> b -> b) -> b -> AnnNestedObjectSelectG b r a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> AnnNestedObjectSelectG b r a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> AnnNestedObjectSelectG b r a -> b)
-> (forall a. (a -> a -> a) -> AnnNestedObjectSelectG b r a -> a)
-> (forall a. (a -> a -> a) -> AnnNestedObjectSelectG b r a -> a)
-> (forall a. AnnNestedObjectSelectG b r a -> [a])
-> (forall a. AnnNestedObjectSelectG b r a -> Bool)
-> (forall a. AnnNestedObjectSelectG b r a -> Int)
-> (forall a. Eq a => a -> AnnNestedObjectSelectG b r a -> Bool)
-> (forall a. Ord a => AnnNestedObjectSelectG b r a -> a)
-> (forall a. Ord a => AnnNestedObjectSelectG b r a -> a)
-> (forall a. Num a => AnnNestedObjectSelectG b r a -> a)
-> (forall a. Num a => AnnNestedObjectSelectG b r a -> a)
-> Foldable (AnnNestedObjectSelectG b r)
forall a. Eq a => a -> AnnNestedObjectSelectG b r a -> Bool
forall a. Num a => AnnNestedObjectSelectG b r a -> a
forall a. Ord a => AnnNestedObjectSelectG b r a -> a
forall m. Monoid m => AnnNestedObjectSelectG b r m -> m
forall a. AnnNestedObjectSelectG b r a -> Bool
forall a. AnnNestedObjectSelectG b r a -> Int
forall a. AnnNestedObjectSelectG b r a -> [a]
forall a. (a -> a -> a) -> AnnNestedObjectSelectG b r a -> a
forall m a.
Monoid m =>
(a -> m) -> AnnNestedObjectSelectG b r a -> m
forall b a. (b -> a -> b) -> b -> AnnNestedObjectSelectG b r a -> b
forall a b. (a -> b -> b) -> b -> AnnNestedObjectSelectG b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnNestedObjectSelectG b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnNestedObjectSelectG b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnNestedObjectSelectG b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnNestedObjectSelectG b r m -> m
forall (b :: BackendType) r a.
Backend b =>
AnnNestedObjectSelectG b r a -> Bool
forall (b :: BackendType) r a.
Backend b =>
AnnNestedObjectSelectG b r a -> Int
forall (b :: BackendType) r a.
Backend b =>
AnnNestedObjectSelectG b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnNestedObjectSelectG b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnNestedObjectSelectG b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnNestedObjectSelectG b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnNestedObjectSelectG b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnNestedObjectSelectG b r m -> m
fold :: forall m. Monoid m => AnnNestedObjectSelectG b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnNestedObjectSelectG b r a -> m
foldMap :: forall m a.
Monoid m =>
(a -> m) -> AnnNestedObjectSelectG b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnNestedObjectSelectG b r a -> m
foldMap' :: forall m a.
Monoid m =>
(a -> m) -> AnnNestedObjectSelectG b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnNestedObjectSelectG b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> AnnNestedObjectSelectG b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnNestedObjectSelectG b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> AnnNestedObjectSelectG b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnNestedObjectSelectG b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> AnnNestedObjectSelectG b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnNestedObjectSelectG b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> AnnNestedObjectSelectG b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnNestedObjectSelectG b r a -> a
foldr1 :: forall a. (a -> a -> a) -> AnnNestedObjectSelectG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnNestedObjectSelectG b r a -> a
foldl1 :: forall a. (a -> a -> a) -> AnnNestedObjectSelectG b r a -> a
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
AnnNestedObjectSelectG b r a -> [a]
toList :: forall a. AnnNestedObjectSelectG b r a -> [a]
$cnull :: forall (b :: BackendType) r a.
Backend b =>
AnnNestedObjectSelectG b r a -> Bool
null :: forall a. AnnNestedObjectSelectG b r a -> Bool
$clength :: forall (b :: BackendType) r a.
Backend b =>
AnnNestedObjectSelectG b r a -> Int
length :: forall a. AnnNestedObjectSelectG b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnNestedObjectSelectG b r a -> Bool
elem :: forall a. Eq a => a -> AnnNestedObjectSelectG b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnNestedObjectSelectG b r a -> a
maximum :: forall a. Ord a => AnnNestedObjectSelectG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnNestedObjectSelectG b r a -> a
minimum :: forall a. Ord a => AnnNestedObjectSelectG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnNestedObjectSelectG b r a -> a
sum :: forall a. Num a => AnnNestedObjectSelectG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnNestedObjectSelectG b r a -> a
product :: forall a. Num a => AnnNestedObjectSelectG b r a -> a
Foldable, Functor (AnnNestedObjectSelectG b r)
Foldable (AnnNestedObjectSelectG b r)
Functor (AnnNestedObjectSelectG b r)
-> Foldable (AnnNestedObjectSelectG b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b)
    -> AnnNestedObjectSelectG b r a
    -> f (AnnNestedObjectSelectG b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnNestedObjectSelectG b r (f a)
    -> f (AnnNestedObjectSelectG b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b)
    -> AnnNestedObjectSelectG b r a
    -> m (AnnNestedObjectSelectG b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnNestedObjectSelectG b r (m a)
    -> m (AnnNestedObjectSelectG b r a))
-> Traversable (AnnNestedObjectSelectG b r)
forall (b :: BackendType) r.
Backend b =>
Functor (AnnNestedObjectSelectG b r)
forall (b :: BackendType) r.
Backend b =>
Foldable (AnnNestedObjectSelectG b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnNestedObjectSelectG b r (m a)
-> m (AnnNestedObjectSelectG b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnNestedObjectSelectG b r (f a)
-> f (AnnNestedObjectSelectG b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> AnnNestedObjectSelectG b r a -> m (AnnNestedObjectSelectG b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> AnnNestedObjectSelectG b r a -> f (AnnNestedObjectSelectG b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
AnnNestedObjectSelectG b r (m a)
-> m (AnnNestedObjectSelectG b r a)
forall (f :: * -> *) a.
Applicative f =>
AnnNestedObjectSelectG b r (f a)
-> f (AnnNestedObjectSelectG b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> AnnNestedObjectSelectG b r a -> m (AnnNestedObjectSelectG b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> AnnNestedObjectSelectG b r a -> f (AnnNestedObjectSelectG b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> AnnNestedObjectSelectG b r a -> f (AnnNestedObjectSelectG b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> AnnNestedObjectSelectG b r a -> f (AnnNestedObjectSelectG b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnNestedObjectSelectG b r (f a)
-> f (AnnNestedObjectSelectG b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
AnnNestedObjectSelectG b r (f a)
-> f (AnnNestedObjectSelectG b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> AnnNestedObjectSelectG b r a -> m (AnnNestedObjectSelectG b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> AnnNestedObjectSelectG b r a -> m (AnnNestedObjectSelectG b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnNestedObjectSelectG b r (m a)
-> m (AnnNestedObjectSelectG b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
AnnNestedObjectSelectG b r (m a)
-> m (AnnNestedObjectSelectG b r a)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AnnFieldsG b r v)
  ) =>
  Eq (AnnNestedObjectSelectG b r v)

deriving stock instance
  ( Backend b,
    Show (AnnFieldsG b r v)
  ) =>
  Show (AnnNestedObjectSelectG b r v)

instance (Backend b) => Bifoldable (AnnNestedObjectSelectG b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnNestedObjectSelectG b a b -> m
bifoldMap a -> m
f b -> m
g AnnNestedObjectSelectG {AnnFieldsG b a b
Column b
XNestedObjects b
$sel:_anosSupportsNestedObjects:AnnNestedObjectSelectG :: forall (b :: BackendType) r v.
AnnNestedObjectSelectG b r v -> XNestedObjects b
$sel:_anosColumn:AnnNestedObjectSelectG :: forall (b :: BackendType) r v.
AnnNestedObjectSelectG b r v -> Column b
$sel:_anosFields:AnnNestedObjectSelectG :: forall (b :: BackendType) r v.
AnnNestedObjectSelectG b r v -> AnnFieldsG b r v
_anosSupportsNestedObjects :: XNestedObjects b
_anosColumn :: Column b
_anosFields :: AnnFieldsG b a b
..} =
    ((FieldName, AnnFieldG b a b) -> m) -> AnnFieldsG b a b -> m
forall m a. Monoid m => (a -> m) -> [a] -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b a b -> m) -> (FieldName, AnnFieldG b a b) -> m
forall m a. Monoid m => (a -> m) -> (FieldName, a) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnFieldG b a b -> m) -> (FieldName, AnnFieldG b a b) -> m)
-> (AnnFieldG b a b -> m) -> (FieldName, AnnFieldG b a b) -> m
forall a b. (a -> b) -> a -> b
$ (a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g) AnnFieldsG b a b
_anosFields

type AnnNestedObjectSelect b r = AnnNestedObjectSelectG b r (SQLExpression b)

-- Nested arrays

data AnnNestedArraySelectG (b :: BackendType) (r :: Type) v
  = ANASSimple (AnnFieldG b r v)
  | ANASAggregate (AnnAggregateSelectG b r v)
  deriving stock ((forall a b.
 (a -> b)
 -> AnnNestedArraySelectG b r a -> AnnNestedArraySelectG b r b)
-> (forall a b.
    a -> AnnNestedArraySelectG b r b -> AnnNestedArraySelectG b r a)
-> Functor (AnnNestedArraySelectG b r)
forall a b.
a -> AnnNestedArraySelectG b r b -> AnnNestedArraySelectG b r a
forall a b.
(a -> b)
-> AnnNestedArraySelectG b r a -> AnnNestedArraySelectG b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> AnnNestedArraySelectG b r b -> AnnNestedArraySelectG b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b)
-> AnnNestedArraySelectG b r a -> AnnNestedArraySelectG b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b)
-> AnnNestedArraySelectG b r a -> AnnNestedArraySelectG b r b
fmap :: forall a b.
(a -> b)
-> AnnNestedArraySelectG b r a -> AnnNestedArraySelectG b r b
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> AnnNestedArraySelectG b r b -> AnnNestedArraySelectG b r a
<$ :: forall a b.
a -> AnnNestedArraySelectG b r b -> AnnNestedArraySelectG b r a
Functor, (forall m. Monoid m => AnnNestedArraySelectG b r m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnNestedArraySelectG b r a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnNestedArraySelectG b r a -> m)
-> (forall a b.
    (a -> b -> b) -> b -> AnnNestedArraySelectG b r a -> b)
-> (forall a b.
    (a -> b -> b) -> b -> AnnNestedArraySelectG b r a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> AnnNestedArraySelectG b r a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> AnnNestedArraySelectG b r a -> b)
-> (forall a. (a -> a -> a) -> AnnNestedArraySelectG b r a -> a)
-> (forall a. (a -> a -> a) -> AnnNestedArraySelectG b r a -> a)
-> (forall a. AnnNestedArraySelectG b r a -> [a])
-> (forall a. AnnNestedArraySelectG b r a -> Bool)
-> (forall a. AnnNestedArraySelectG b r a -> Int)
-> (forall a. Eq a => a -> AnnNestedArraySelectG b r a -> Bool)
-> (forall a. Ord a => AnnNestedArraySelectG b r a -> a)
-> (forall a. Ord a => AnnNestedArraySelectG b r a -> a)
-> (forall a. Num a => AnnNestedArraySelectG b r a -> a)
-> (forall a. Num a => AnnNestedArraySelectG b r a -> a)
-> Foldable (AnnNestedArraySelectG b r)
forall a. Eq a => a -> AnnNestedArraySelectG b r a -> Bool
forall a. Num a => AnnNestedArraySelectG b r a -> a
forall a. Ord a => AnnNestedArraySelectG b r a -> a
forall m. Monoid m => AnnNestedArraySelectG b r m -> m
forall a. AnnNestedArraySelectG b r a -> Bool
forall a. AnnNestedArraySelectG b r a -> Int
forall a. AnnNestedArraySelectG b r a -> [a]
forall a. (a -> a -> a) -> AnnNestedArraySelectG b r a -> a
forall m a.
Monoid m =>
(a -> m) -> AnnNestedArraySelectG b r a -> m
forall b a. (b -> a -> b) -> b -> AnnNestedArraySelectG b r a -> b
forall a b. (a -> b -> b) -> b -> AnnNestedArraySelectG b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnNestedArraySelectG b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnNestedArraySelectG b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnNestedArraySelectG b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnNestedArraySelectG b r m -> m
forall (b :: BackendType) r a.
Backend b =>
AnnNestedArraySelectG b r a -> Bool
forall (b :: BackendType) r a.
Backend b =>
AnnNestedArraySelectG b r a -> Int
forall (b :: BackendType) r a.
Backend b =>
AnnNestedArraySelectG b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnNestedArraySelectG b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnNestedArraySelectG b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnNestedArraySelectG b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnNestedArraySelectG b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnNestedArraySelectG b r m -> m
fold :: forall m. Monoid m => AnnNestedArraySelectG b r m -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnNestedArraySelectG b r a -> m
foldMap :: forall m a.
Monoid m =>
(a -> m) -> AnnNestedArraySelectG b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnNestedArraySelectG b r a -> m
foldMap' :: forall m a.
Monoid m =>
(a -> m) -> AnnNestedArraySelectG b r a -> m
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnNestedArraySelectG b r a -> b
foldr :: forall a b. (a -> b -> b) -> b -> AnnNestedArraySelectG b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnNestedArraySelectG b r a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> AnnNestedArraySelectG b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnNestedArraySelectG b r a -> b
foldl :: forall b a. (b -> a -> b) -> b -> AnnNestedArraySelectG b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnNestedArraySelectG b r a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> AnnNestedArraySelectG b r a -> b
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnNestedArraySelectG b r a -> a
foldr1 :: forall a. (a -> a -> a) -> AnnNestedArraySelectG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnNestedArraySelectG b r a -> a
foldl1 :: forall a. (a -> a -> a) -> AnnNestedArraySelectG b r a -> a
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
AnnNestedArraySelectG b r a -> [a]
toList :: forall a. AnnNestedArraySelectG b r a -> [a]
$cnull :: forall (b :: BackendType) r a.
Backend b =>
AnnNestedArraySelectG b r a -> Bool
null :: forall a. AnnNestedArraySelectG b r a -> Bool
$clength :: forall (b :: BackendType) r a.
Backend b =>
AnnNestedArraySelectG b r a -> Int
length :: forall a. AnnNestedArraySelectG b r a -> Int
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnNestedArraySelectG b r a -> Bool
elem :: forall a. Eq a => a -> AnnNestedArraySelectG b r a -> Bool
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnNestedArraySelectG b r a -> a
maximum :: forall a. Ord a => AnnNestedArraySelectG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnNestedArraySelectG b r a -> a
minimum :: forall a. Ord a => AnnNestedArraySelectG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnNestedArraySelectG b r a -> a
sum :: forall a. Num a => AnnNestedArraySelectG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnNestedArraySelectG b r a -> a
product :: forall a. Num a => AnnNestedArraySelectG b r a -> a
Foldable, Functor (AnnNestedArraySelectG b r)
Foldable (AnnNestedArraySelectG b r)
Functor (AnnNestedArraySelectG b r)
-> Foldable (AnnNestedArraySelectG b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b)
    -> AnnNestedArraySelectG b r a -> f (AnnNestedArraySelectG b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnNestedArraySelectG b r (f a) -> f (AnnNestedArraySelectG b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b)
    -> AnnNestedArraySelectG b r a -> m (AnnNestedArraySelectG b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnNestedArraySelectG b r (m a) -> m (AnnNestedArraySelectG b r a))
-> Traversable (AnnNestedArraySelectG b r)
forall (b :: BackendType) r.
Backend b =>
Functor (AnnNestedArraySelectG b r)
forall (b :: BackendType) r.
Backend b =>
Foldable (AnnNestedArraySelectG b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnNestedArraySelectG b r (m a) -> m (AnnNestedArraySelectG b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnNestedArraySelectG b r (f a) -> f (AnnNestedArraySelectG b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> AnnNestedArraySelectG b r a -> m (AnnNestedArraySelectG b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> AnnNestedArraySelectG b r a -> f (AnnNestedArraySelectG b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
AnnNestedArraySelectG b r (m a) -> m (AnnNestedArraySelectG b r a)
forall (f :: * -> *) a.
Applicative f =>
AnnNestedArraySelectG b r (f a) -> f (AnnNestedArraySelectG b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> AnnNestedArraySelectG b r a -> m (AnnNestedArraySelectG b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> AnnNestedArraySelectG b r a -> f (AnnNestedArraySelectG b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> AnnNestedArraySelectG b r a -> f (AnnNestedArraySelectG b r b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> AnnNestedArraySelectG b r a -> f (AnnNestedArraySelectG b r b)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnNestedArraySelectG b r (f a) -> f (AnnNestedArraySelectG b r a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
AnnNestedArraySelectG b r (f a) -> f (AnnNestedArraySelectG b r a)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> AnnNestedArraySelectG b r a -> m (AnnNestedArraySelectG b r b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> AnnNestedArraySelectG b r a -> m (AnnNestedArraySelectG b r b)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnNestedArraySelectG b r (m a) -> m (AnnNestedArraySelectG b r a)
sequence :: forall (m :: * -> *) a.
Monad m =>
AnnNestedArraySelectG b r (m a) -> m (AnnNestedArraySelectG b r a)
Traversable)

deriving stock instance
  (Backend b, Eq (AnnFieldG b r v), Eq (AnnAggregateSelectG b r v)) => Eq (AnnNestedArraySelectG b r v)

deriving stock instance
  (Backend b, Show (AnnFieldG b r v), Show (AnnAggregateSelectG b r v)) => Show (AnnNestedArraySelectG b r v)

instance (Backend b) => Bifoldable (AnnNestedArraySelectG b) where
  bifoldMap :: forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnNestedArraySelectG b a b -> m
bifoldMap a -> m
f b -> m
g = \case
    ANASSimple AnnFieldG b a b
field -> (a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall m a b.
Monoid m =>
(a -> m) -> (b -> m) -> AnnFieldG b a b -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap a -> m
f b -> m
g AnnFieldG b a b
field
    ANASAggregate AnnAggregateSelectG b a b
agg -> (a -> m) -> (b -> m) -> AnnAggregateSelectG b a b -> m
forall (b :: BackendType) (f :: BackendType -> * -> * -> *) m r v.
(Backend b, Bifoldable (f b), Monoid m) =>
(r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG a -> m
f b -> m
g AnnAggregateSelectG b a b
agg

type AnnNestedArraySelect b r = AnnNestedArraySelectG b r (SQLExpression b)

-- | If argument positional index is less than or equal to length of
-- 'positional' arguments then insert the value in 'positional' arguments else
-- insert the value with argument name in 'named' arguments
insertFunctionArg ::
  FunctionArgName ->
  Int ->
  a ->
  FunctionArgsExpG a ->
  FunctionArgsExpG a
insertFunctionArg :: forall a.
FunctionArgName
-> Int -> a -> FunctionArgsExpG a -> FunctionArgsExpG a
insertFunctionArg FunctionArgName
argName Int
idx a
value (FunctionArgsExp [a]
positional HashMap Text a
named) =
  if (Int
idx Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
1) Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= [a] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [a]
positional
    then [a] -> HashMap Text a -> FunctionArgsExpG a
forall a. [a] -> HashMap Text a -> FunctionArgsExpG a
FunctionArgsExp (Int -> a -> [a] -> [a]
forall {a}. Int -> a -> [a] -> [a]
insertAt Int
idx a
value [a]
positional) HashMap Text a
named
    else
      [a] -> HashMap Text a -> FunctionArgsExpG a
forall a. [a] -> HashMap Text a -> FunctionArgsExpG a
FunctionArgsExp [a]
positional
        (HashMap Text a -> FunctionArgsExpG a)
-> HashMap Text a -> FunctionArgsExpG a
forall a b. (a -> b) -> a -> b
$ Text -> a -> HashMap Text a -> HashMap Text a
forall k v.
(Eq k, Hashable k) =>
k -> v -> HashMap k v -> HashMap k v
HashMap.insert (FunctionArgName -> Text
getFuncArgNameTxt FunctionArgName
argName) a
value HashMap Text a
named
  where
    insertAt :: Int -> a -> [a] -> [a]
insertAt Int
i a
a = Seq a -> [a]
forall a. Seq a -> [a]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList (Seq a -> [a]) -> ([a] -> Seq a) -> [a] -> [a]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> Seq a -> Seq a
forall a. Int -> a -> Seq a -> Seq a
Seq.insertAt Int
i a
a (Seq a -> Seq a) -> ([a] -> Seq a) -> [a] -> Seq a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> Seq a
forall a. [a] -> Seq a
Seq.fromList

-- | The "distinct" input field inside "count" aggregate field
--
-- count (
--   distinct: Boolean
-- ): Int
data CountDistinct
  = SelectCountDistinct
  | SelectCountNonDistinct