{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
{-# 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,
    AnnObjectSelect,
    AnnObjectSelectG (..),
    AnnRelationSelectG (..),
    AnnSelectG (..),
    AnnSelectStreamG (..),
    AnnSimpleSelect,
    AnnSimpleSelectG,
    AnnSimpleStreamSelect,
    AnnSimpleStreamSelectG,
    AnnotatedAggregateOrderBy (..),
    AnnotatedOrderByElement (..),
    AnnotatedOrderByItem,
    AnnotatedOrderByItemG,
    ArrayAggregateSelect,
    ArrayAggregateSelectG,
    ArrayConnectionSelect,
    ArrayRelationSelectG,
    ArraySelect,
    ArraySelectFieldsG,
    ArraySelectG (..),
    ColFld (..),
    ColumnFields,
    ComputedFieldOrderBy (..),
    ComputedFieldOrderByElement (..),
    ComputedFieldScalarSelect (..),
    ComputedFieldSelect (..),
    ConnectionField (..),
    ConnectionFields,
    ConnectionSelect (..),
    ConnectionSlice (..),
    ConnectionSplit (..),
    ConnectionSplitKind (..),
    EdgeField (..),
    EdgeFields,
    FIIdentifier (..),
    ObjectRelationSelect,
    ObjectRelationSelectG,
    PageInfoField (..),
    PageInfoFields,
    QueryDB (..),
    RemoteSourceSelect (..),
    SelectArgs,
    SelectArgsG (..),
    SelectStreamArgsG (..),
    SelectStreamArgs,
    SelectFrom,
    SelectFromG (..),
    RemoteRelationshipSelect (..),
    SourceRelationshipSelection (..),
    StreamCursorItem (..),
    TableAggregateField,
    TableAggregateFieldG (..),
    TableAggregateFields,
    TableAggregateFieldsG,
    TablePerm,
    TablePermG (..),
    CountDistinct (..),
    aarRelationshipName,
    aarColumnMapping,
    aarAnnSelect,
    aosFields,
    aosTableFrom,
    aosTableFilter,
    asnArgs,
    asnFields,
    asnFrom,
    asnPerm,
    asnStrfyNum,
    asnNamingConvention,
    bifoldMapAnnSelectG,
    csXRelay,
    csPrimaryKeyColumns,
    csSplit,
    csSlice,
    csSelect,
    insertFunctionArg,
    mkAnnColumnField,
    mkAnnColumnFieldAsText,
    noSelectArgs,
    noTablePermissions,
    saDistinct,
    saLimit,
    saOffset,
    saOrderBy,
    saWhere,
    traverseSourceRelationshipSelection,
    _AFArrayRelation,
    _AFColumn,
    _AFComputedField,
    _AFExpression,
    _AFNodeId,
    _AFObjectRelation,
    _AFRemote,
    _AOCArrayAggregation,
    _AOCColumn,
    _AOCComputedField,
    _AOCObjectRelation,
    _TAFAgg,
    _TAFNodes,
    _TAFExp,
    _ConnectionTypename,
    _ConnectionPageInfo,
    _ConnectionEdges,
    _EdgeTypename,
    _EdgeCursor,
    _EdgeNode,
  )
where

import Control.Lens.TH (makeLenses, makePrisms)
import Data.Bifoldable
import Data.HashMap.Strict qualified as HM
import Data.Int (Int64)
import Data.Kind (Type)
import Data.List.NonEmpty qualified as NE
import Data.Sequence qualified as Seq
import Hasura.Backends.Postgres.SQL.Types qualified as PG
import Hasura.GraphQL.Schema.NamingCase (NamingCase)
import Hasura.GraphQL.Schema.Options (StringifyNumbers)
import Hasura.Prelude
import Hasura.RQL.IR.BoolExp
import Hasura.RQL.IR.OrderBy
import Hasura.RQL.Types.Backend
import Hasura.RQL.Types.Column
import Hasura.RQL.Types.Common
import Hasura.RQL.Types.ComputedField
import Hasura.RQL.Types.Function
import Hasura.RQL.Types.Instances ()
import Hasura.RQL.Types.Relationships.Local
import Hasura.RQL.Types.Relationships.Remote
import Hasura.RQL.Types.Subscription
import Hasura.SQL.Backend

-- 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
$cto :: forall (b :: BackendType) r v x.
Rep (QueryDB b r v) x -> QueryDB b r v
$cfrom :: forall (b :: BackendType) r v x.
QueryDB b r v -> Rep (QueryDB b r v) x
Generic, a -> QueryDB b r b -> QueryDB b r a
(a -> b) -> QueryDB b r a -> QueryDB b r b
(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
<$ :: a -> QueryDB b r b -> QueryDB b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> QueryDB b r b -> QueryDB b r a
fmap :: (a -> b) -> QueryDB b r a -> QueryDB b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> QueryDB b r a -> QueryDB b r b
Functor, QueryDB b r a -> Bool
(a -> m) -> QueryDB b r a -> m
(a -> b -> b) -> b -> QueryDB b r a -> b
(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
product :: QueryDB b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
QueryDB b r a -> a
sum :: QueryDB b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
QueryDB b r a -> a
minimum :: QueryDB b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
QueryDB b r a -> a
maximum :: QueryDB b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
QueryDB b r a -> a
elem :: a -> QueryDB b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> QueryDB b r a -> Bool
length :: QueryDB b r a -> Int
$clength :: forall (b :: BackendType) r a. Backend b => QueryDB b r a -> Int
null :: QueryDB b r a -> Bool
$cnull :: forall (b :: BackendType) r a. Backend b => QueryDB b r a -> Bool
toList :: QueryDB b r a -> [a]
$ctoList :: forall (b :: BackendType) r a. Backend b => QueryDB b r a -> [a]
foldl1 :: (a -> a -> a) -> QueryDB b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> QueryDB b r a -> a
foldr1 :: (a -> a -> a) -> QueryDB b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> QueryDB b r a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: QueryDB b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
QueryDB b r m -> m
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)
(a -> f b) -> QueryDB b r a -> f (QueryDB b r b)
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)
sequence :: QueryDB b r (m a) -> m (QueryDB b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
QueryDB b r (m a) -> m (QueryDB b r a)
mapM :: (a -> m b) -> QueryDB b r a -> m (QueryDB b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> QueryDB b r a -> m (QueryDB b r b)
sequenceA :: QueryDB b r (f a) -> f (QueryDB b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
QueryDB b r (f a) -> f (QueryDB b r a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType) r. Backend b => Foldable (QueryDB b r)
$cp1Traversable :: forall (b :: BackendType) r. Backend b => Functor (QueryDB b r)
Traversable)

instance Backend b => Bifoldable (QueryDB b) where
  bifoldMap :: (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 (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

data AnnSelectG (b :: BackendType) (f :: Type -> Type) (v :: Type) = AnnSelectG
  { AnnSelectG b f v -> Fields (f v)
_asnFields :: Fields (f v),
    AnnSelectG b f v -> SelectFromG b v
_asnFrom :: SelectFromG b v,
    AnnSelectG b f v -> TablePermG b v
_asnPerm :: TablePermG b v,
    AnnSelectG b f v -> SelectArgsG b v
_asnArgs :: SelectArgsG b v,
    AnnSelectG b f v -> StringifyNumbers
_asnStrfyNum :: StringifyNumbers,
    AnnSelectG b f v -> Maybe NamingCase
_asnNamingConvention :: Maybe NamingCase
  }
  deriving stock (a -> AnnSelectG b f b -> AnnSelectG b f a
(a -> b) -> AnnSelectG b f a -> AnnSelectG b f b
(forall a b. (a -> b) -> AnnSelectG b f a -> AnnSelectG b f b)
-> (forall a b. a -> AnnSelectG b f b -> AnnSelectG b f a)
-> Functor (AnnSelectG b f)
forall a b. a -> AnnSelectG b f b -> AnnSelectG b f a
forall a b. (a -> b) -> AnnSelectG b f a -> AnnSelectG b f b
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Functor f) =>
a -> AnnSelectG b f b -> AnnSelectG b f a
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Functor f) =>
(a -> b) -> AnnSelectG b f a -> AnnSelectG b f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> AnnSelectG b f b -> AnnSelectG b f a
$c<$ :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Functor f) =>
a -> AnnSelectG b f b -> AnnSelectG b f a
fmap :: (a -> b) -> AnnSelectG b f a -> AnnSelectG b f b
$cfmap :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Functor f) =>
(a -> b) -> AnnSelectG b f a -> AnnSelectG b f b
Functor, AnnSelectG b f a -> Bool
(a -> m) -> AnnSelectG b f a -> m
(a -> b -> b) -> b -> AnnSelectG b f a -> b
(forall m. Monoid m => AnnSelectG b f m -> m)
-> (forall m a. Monoid m => (a -> m) -> AnnSelectG b f a -> m)
-> (forall m a. Monoid m => (a -> m) -> AnnSelectG b f a -> m)
-> (forall a b. (a -> b -> b) -> b -> AnnSelectG b f a -> b)
-> (forall a b. (a -> b -> b) -> b -> AnnSelectG b f a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnSelectG b f a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnSelectG b f a -> b)
-> (forall a. (a -> a -> a) -> AnnSelectG b f a -> a)
-> (forall a. (a -> a -> a) -> AnnSelectG b f a -> a)
-> (forall a. AnnSelectG b f a -> [a])
-> (forall a. AnnSelectG b f a -> Bool)
-> (forall a. AnnSelectG b f a -> Int)
-> (forall a. Eq a => a -> AnnSelectG b f a -> Bool)
-> (forall a. Ord a => AnnSelectG b f a -> a)
-> (forall a. Ord a => AnnSelectG b f a -> a)
-> (forall a. Num a => AnnSelectG b f a -> a)
-> (forall a. Num a => AnnSelectG b f a -> a)
-> Foldable (AnnSelectG b f)
forall a. Eq a => a -> AnnSelectG b f a -> Bool
forall a. Num a => AnnSelectG b f a -> a
forall a. Ord a => AnnSelectG b f a -> a
forall m. Monoid m => AnnSelectG b f m -> m
forall a. AnnSelectG b f a -> Bool
forall a. AnnSelectG b f a -> Int
forall a. AnnSelectG b f a -> [a]
forall a. (a -> a -> a) -> AnnSelectG b f a -> a
forall m a. Monoid m => (a -> m) -> AnnSelectG b f a -> m
forall b a. (b -> a -> b) -> b -> AnnSelectG b f a -> b
forall a b. (a -> b -> b) -> b -> AnnSelectG b f a -> b
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Eq a) =>
a -> AnnSelectG b f a -> Bool
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Num a) =>
AnnSelectG b f a -> a
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Ord a) =>
AnnSelectG b f a -> a
forall (b :: BackendType) (f :: * -> *) m.
(Backend b, Foldable f, Monoid m) =>
AnnSelectG b f m -> m
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectG b f a -> Bool
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectG b f a -> Int
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectG b f a -> [a]
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
(a -> a -> a) -> AnnSelectG b f a -> a
forall (b :: BackendType) (f :: * -> *) m a.
(Backend b, Foldable f, Monoid m) =>
(a -> m) -> AnnSelectG b f a -> m
forall (b :: BackendType) (f :: * -> *) b a.
(Backend b, Foldable f) =>
(b -> a -> b) -> b -> AnnSelectG b f a -> b
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Foldable f) =>
(a -> b -> b) -> b -> AnnSelectG b f 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
product :: AnnSelectG b f a -> a
$cproduct :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Num a) =>
AnnSelectG b f a -> a
sum :: AnnSelectG b f a -> a
$csum :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Num a) =>
AnnSelectG b f a -> a
minimum :: AnnSelectG b f a -> a
$cminimum :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Ord a) =>
AnnSelectG b f a -> a
maximum :: AnnSelectG b f a -> a
$cmaximum :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Ord a) =>
AnnSelectG b f a -> a
elem :: a -> AnnSelectG b f a -> Bool
$celem :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Eq a) =>
a -> AnnSelectG b f a -> Bool
length :: AnnSelectG b f a -> Int
$clength :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectG b f a -> Int
null :: AnnSelectG b f a -> Bool
$cnull :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectG b f a -> Bool
toList :: AnnSelectG b f a -> [a]
$ctoList :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectG b f a -> [a]
foldl1 :: (a -> a -> a) -> AnnSelectG b f a -> a
$cfoldl1 :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
(a -> a -> a) -> AnnSelectG b f a -> a
foldr1 :: (a -> a -> a) -> AnnSelectG b f a -> a
$cfoldr1 :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
(a -> a -> a) -> AnnSelectG b f a -> a
foldl' :: (b -> a -> b) -> b -> AnnSelectG b f a -> b
$cfoldl' :: forall (b :: BackendType) (f :: * -> *) b a.
(Backend b, Foldable f) =>
(b -> a -> b) -> b -> AnnSelectG b f a -> b
foldl :: (b -> a -> b) -> b -> AnnSelectG b f a -> b
$cfoldl :: forall (b :: BackendType) (f :: * -> *) b a.
(Backend b, Foldable f) =>
(b -> a -> b) -> b -> AnnSelectG b f a -> b
foldr' :: (a -> b -> b) -> b -> AnnSelectG b f a -> b
$cfoldr' :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Foldable f) =>
(a -> b -> b) -> b -> AnnSelectG b f a -> b
foldr :: (a -> b -> b) -> b -> AnnSelectG b f a -> b
$cfoldr :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Foldable f) =>
(a -> b -> b) -> b -> AnnSelectG b f a -> b
foldMap' :: (a -> m) -> AnnSelectG b f a -> m
$cfoldMap' :: forall (b :: BackendType) (f :: * -> *) m a.
(Backend b, Foldable f, Monoid m) =>
(a -> m) -> AnnSelectG b f a -> m
foldMap :: (a -> m) -> AnnSelectG b f a -> m
$cfoldMap :: forall (b :: BackendType) (f :: * -> *) m a.
(Backend b, Foldable f, Monoid m) =>
(a -> m) -> AnnSelectG b f a -> m
fold :: AnnSelectG b f m -> m
$cfold :: forall (b :: BackendType) (f :: * -> *) m.
(Backend b, Foldable f, Monoid m) =>
AnnSelectG b f m -> m
Foldable, Functor (AnnSelectG b f)
Foldable (AnnSelectG b f)
Functor (AnnSelectG b f)
-> Foldable (AnnSelectG b f)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> AnnSelectG b f a -> f (AnnSelectG b f b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnSelectG b f (f a) -> f (AnnSelectG b f a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> AnnSelectG b f a -> m (AnnSelectG b f b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnSelectG b f (m a) -> m (AnnSelectG b f a))
-> Traversable (AnnSelectG b f)
(a -> f b) -> AnnSelectG b f a -> f (AnnSelectG b f b)
forall (b :: BackendType) (f :: * -> *).
(Backend b, Traversable f) =>
Functor (AnnSelectG b f)
forall (b :: BackendType) (f :: * -> *).
(Backend b, Traversable f) =>
Foldable (AnnSelectG b f)
forall (b :: BackendType) (f :: * -> *) (m :: * -> *) a.
(Backend b, Traversable f, Monad m) =>
AnnSelectG b f (m a) -> m (AnnSelectG b f a)
forall (b :: BackendType) (f :: * -> *) (f :: * -> *) a.
(Backend b, Traversable f, Applicative f) =>
AnnSelectG b f (f a) -> f (AnnSelectG b f a)
forall (b :: BackendType) (f :: * -> *) (m :: * -> *) a b.
(Backend b, Traversable f, Monad m) =>
(a -> m b) -> AnnSelectG b f a -> m (AnnSelectG b f b)
forall (b :: BackendType) (f :: * -> *) (f :: * -> *) a b.
(Backend b, Traversable f, Applicative f) =>
(a -> f b) -> AnnSelectG b f a -> f (AnnSelectG b f 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 =>
AnnSelectG b f (m a) -> m (AnnSelectG b f a)
forall (f :: * -> *) a.
Applicative f =>
AnnSelectG b f (f a) -> f (AnnSelectG b f a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnSelectG b f a -> m (AnnSelectG b f b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnSelectG b f a -> f (AnnSelectG b f b)
sequence :: AnnSelectG b f (m a) -> m (AnnSelectG b f a)
$csequence :: forall (b :: BackendType) (f :: * -> *) (m :: * -> *) a.
(Backend b, Traversable f, Monad m) =>
AnnSelectG b f (m a) -> m (AnnSelectG b f a)
mapM :: (a -> m b) -> AnnSelectG b f a -> m (AnnSelectG b f b)
$cmapM :: forall (b :: BackendType) (f :: * -> *) (m :: * -> *) a b.
(Backend b, Traversable f, Monad m) =>
(a -> m b) -> AnnSelectG b f a -> m (AnnSelectG b f b)
sequenceA :: AnnSelectG b f (f a) -> f (AnnSelectG b f a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) (f :: * -> *) a.
(Backend b, Traversable f, Applicative f) =>
AnnSelectG b f (f a) -> f (AnnSelectG b f a)
traverse :: (a -> f b) -> AnnSelectG b f a -> f (AnnSelectG b f b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) (f :: * -> *) a b.
(Backend b, Traversable f, Applicative f) =>
(a -> f b) -> AnnSelectG b f a -> f (AnnSelectG b f b)
$cp2Traversable :: forall (b :: BackendType) (f :: * -> *).
(Backend b, Traversable f) =>
Foldable (AnnSelectG b f)
$cp1Traversable :: forall (b :: BackendType) (f :: * -> *).
(Backend b, Traversable f) =>
Functor (AnnSelectG b f)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (Fields (f v)),
    Eq (SelectArgsG b v),
    Eq (SelectFromG b v),
    Eq (TablePermG b v)
  ) =>
  Eq (AnnSelectG b f v)

deriving stock instance
  ( Backend b,
    Show (Fields (f v)),
    Show (SelectArgsG b v),
    Show (SelectFromG b v),
    Show (TablePermG b v)
  ) =>
  Show (AnnSelectG b f v)

-- | IR type representing nodes for streaming subscriptions
data
  AnnSelectStreamG
    (b :: BackendType)
    (f :: Type -> Type)
    (v :: Type) = AnnSelectStreamG
  { -- | type to indicate if streaming subscription has been enabled in the `BackendType`.
    --   This type helps avoiding missing case match patterns for backends where it's disabled.
    AnnSelectStreamG b f v -> XStreamingSubscription b
_assnXStreamingSubscription :: XStreamingSubscription b,
    -- | output selection fields
    AnnSelectStreamG b f v -> Fields (f v)
_assnFields :: Fields (f v),
    -- | table information to select from
    AnnSelectStreamG b f v -> SelectFromG b v
_assnFrom :: SelectFromG b v,
    -- | select permissions
    AnnSelectStreamG b f v -> TablePermG b v
_assnPerm :: TablePermG b v,
    -- | streaming arguments
    AnnSelectStreamG b f v -> SelectStreamArgsG b v
_assnArgs :: SelectStreamArgsG b v,
    AnnSelectStreamG b f v -> StringifyNumbers
_assnStrfyNum :: StringifyNumbers
  }
  deriving (a -> AnnSelectStreamG b f b -> AnnSelectStreamG b f a
(a -> b) -> AnnSelectStreamG b f a -> AnnSelectStreamG b f b
(forall a b.
 (a -> b) -> AnnSelectStreamG b f a -> AnnSelectStreamG b f b)
-> (forall a b.
    a -> AnnSelectStreamG b f b -> AnnSelectStreamG b f a)
-> Functor (AnnSelectStreamG b f)
forall a b. a -> AnnSelectStreamG b f b -> AnnSelectStreamG b f a
forall a b.
(a -> b) -> AnnSelectStreamG b f a -> AnnSelectStreamG b f b
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Functor f) =>
a -> AnnSelectStreamG b f b -> AnnSelectStreamG b f a
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Functor f) =>
(a -> b) -> AnnSelectStreamG b f a -> AnnSelectStreamG b f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> AnnSelectStreamG b f b -> AnnSelectStreamG b f a
$c<$ :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Functor f) =>
a -> AnnSelectStreamG b f b -> AnnSelectStreamG b f a
fmap :: (a -> b) -> AnnSelectStreamG b f a -> AnnSelectStreamG b f b
$cfmap :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Functor f) =>
(a -> b) -> AnnSelectStreamG b f a -> AnnSelectStreamG b f b
Functor, AnnSelectStreamG b f a -> Bool
(a -> m) -> AnnSelectStreamG b f a -> m
(a -> b -> b) -> b -> AnnSelectStreamG b f a -> b
(forall m. Monoid m => AnnSelectStreamG b f m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnSelectStreamG b f a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnSelectStreamG b f a -> m)
-> (forall a b. (a -> b -> b) -> b -> AnnSelectStreamG b f a -> b)
-> (forall a b. (a -> b -> b) -> b -> AnnSelectStreamG b f a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnSelectStreamG b f a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnSelectStreamG b f a -> b)
-> (forall a. (a -> a -> a) -> AnnSelectStreamG b f a -> a)
-> (forall a. (a -> a -> a) -> AnnSelectStreamG b f a -> a)
-> (forall a. AnnSelectStreamG b f a -> [a])
-> (forall a. AnnSelectStreamG b f a -> Bool)
-> (forall a. AnnSelectStreamG b f a -> Int)
-> (forall a. Eq a => a -> AnnSelectStreamG b f a -> Bool)
-> (forall a. Ord a => AnnSelectStreamG b f a -> a)
-> (forall a. Ord a => AnnSelectStreamG b f a -> a)
-> (forall a. Num a => AnnSelectStreamG b f a -> a)
-> (forall a. Num a => AnnSelectStreamG b f a -> a)
-> Foldable (AnnSelectStreamG b f)
forall a. Eq a => a -> AnnSelectStreamG b f a -> Bool
forall a. Num a => AnnSelectStreamG b f a -> a
forall a. Ord a => AnnSelectStreamG b f a -> a
forall m. Monoid m => AnnSelectStreamG b f m -> m
forall a. AnnSelectStreamG b f a -> Bool
forall a. AnnSelectStreamG b f a -> Int
forall a. AnnSelectStreamG b f a -> [a]
forall a. (a -> a -> a) -> AnnSelectStreamG b f a -> a
forall m a. Monoid m => (a -> m) -> AnnSelectStreamG b f a -> m
forall b a. (b -> a -> b) -> b -> AnnSelectStreamG b f a -> b
forall a b. (a -> b -> b) -> b -> AnnSelectStreamG b f a -> b
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Eq a) =>
a -> AnnSelectStreamG b f a -> Bool
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Num a) =>
AnnSelectStreamG b f a -> a
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Ord a) =>
AnnSelectStreamG b f a -> a
forall (b :: BackendType) (f :: * -> *) m.
(Backend b, Foldable f, Monoid m) =>
AnnSelectStreamG b f m -> m
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectStreamG b f a -> Bool
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectStreamG b f a -> Int
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectStreamG b f a -> [a]
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
(a -> a -> a) -> AnnSelectStreamG b f a -> a
forall (b :: BackendType) (f :: * -> *) m a.
(Backend b, Foldable f, Monoid m) =>
(a -> m) -> AnnSelectStreamG b f a -> m
forall (b :: BackendType) (f :: * -> *) b a.
(Backend b, Foldable f) =>
(b -> a -> b) -> b -> AnnSelectStreamG b f a -> b
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Foldable f) =>
(a -> b -> b) -> b -> AnnSelectStreamG b f 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
product :: AnnSelectStreamG b f a -> a
$cproduct :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Num a) =>
AnnSelectStreamG b f a -> a
sum :: AnnSelectStreamG b f a -> a
$csum :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Num a) =>
AnnSelectStreamG b f a -> a
minimum :: AnnSelectStreamG b f a -> a
$cminimum :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Ord a) =>
AnnSelectStreamG b f a -> a
maximum :: AnnSelectStreamG b f a -> a
$cmaximum :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Ord a) =>
AnnSelectStreamG b f a -> a
elem :: a -> AnnSelectStreamG b f a -> Bool
$celem :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f, Eq a) =>
a -> AnnSelectStreamG b f a -> Bool
length :: AnnSelectStreamG b f a -> Int
$clength :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectStreamG b f a -> Int
null :: AnnSelectStreamG b f a -> Bool
$cnull :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectStreamG b f a -> Bool
toList :: AnnSelectStreamG b f a -> [a]
$ctoList :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
AnnSelectStreamG b f a -> [a]
foldl1 :: (a -> a -> a) -> AnnSelectStreamG b f a -> a
$cfoldl1 :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
(a -> a -> a) -> AnnSelectStreamG b f a -> a
foldr1 :: (a -> a -> a) -> AnnSelectStreamG b f a -> a
$cfoldr1 :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Foldable f) =>
(a -> a -> a) -> AnnSelectStreamG b f a -> a
foldl' :: (b -> a -> b) -> b -> AnnSelectStreamG b f a -> b
$cfoldl' :: forall (b :: BackendType) (f :: * -> *) b a.
(Backend b, Foldable f) =>
(b -> a -> b) -> b -> AnnSelectStreamG b f a -> b
foldl :: (b -> a -> b) -> b -> AnnSelectStreamG b f a -> b
$cfoldl :: forall (b :: BackendType) (f :: * -> *) b a.
(Backend b, Foldable f) =>
(b -> a -> b) -> b -> AnnSelectStreamG b f a -> b
foldr' :: (a -> b -> b) -> b -> AnnSelectStreamG b f a -> b
$cfoldr' :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Foldable f) =>
(a -> b -> b) -> b -> AnnSelectStreamG b f a -> b
foldr :: (a -> b -> b) -> b -> AnnSelectStreamG b f a -> b
$cfoldr :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Foldable f) =>
(a -> b -> b) -> b -> AnnSelectStreamG b f a -> b
foldMap' :: (a -> m) -> AnnSelectStreamG b f a -> m
$cfoldMap' :: forall (b :: BackendType) (f :: * -> *) m a.
(Backend b, Foldable f, Monoid m) =>
(a -> m) -> AnnSelectStreamG b f a -> m
foldMap :: (a -> m) -> AnnSelectStreamG b f a -> m
$cfoldMap :: forall (b :: BackendType) (f :: * -> *) m a.
(Backend b, Foldable f, Monoid m) =>
(a -> m) -> AnnSelectStreamG b f a -> m
fold :: AnnSelectStreamG b f m -> m
$cfold :: forall (b :: BackendType) (f :: * -> *) m.
(Backend b, Foldable f, Monoid m) =>
AnnSelectStreamG b f m -> m
Foldable, Functor (AnnSelectStreamG b f)
Foldable (AnnSelectStreamG b f)
Functor (AnnSelectStreamG b f)
-> Foldable (AnnSelectStreamG b f)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> AnnSelectStreamG b f a -> f (AnnSelectStreamG b f b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnSelectStreamG b f (f a) -> f (AnnSelectStreamG b f a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> AnnSelectStreamG b f a -> m (AnnSelectStreamG b f b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnSelectStreamG b f (m a) -> m (AnnSelectStreamG b f a))
-> Traversable (AnnSelectStreamG b f)
(a -> f b) -> AnnSelectStreamG b f a -> f (AnnSelectStreamG b f b)
forall (b :: BackendType) (f :: * -> *).
(Backend b, Traversable f) =>
Functor (AnnSelectStreamG b f)
forall (b :: BackendType) (f :: * -> *).
(Backend b, Traversable f) =>
Foldable (AnnSelectStreamG b f)
forall (b :: BackendType) (f :: * -> *) (m :: * -> *) a.
(Backend b, Traversable f, Monad m) =>
AnnSelectStreamG b f (m a) -> m (AnnSelectStreamG b f a)
forall (b :: BackendType) (f :: * -> *) (f :: * -> *) a.
(Backend b, Traversable f, Applicative f) =>
AnnSelectStreamG b f (f a) -> f (AnnSelectStreamG b f a)
forall (b :: BackendType) (f :: * -> *) (m :: * -> *) a b.
(Backend b, Traversable f, Monad m) =>
(a -> m b) -> AnnSelectStreamG b f a -> m (AnnSelectStreamG b f b)
forall (b :: BackendType) (f :: * -> *) (f :: * -> *) a b.
(Backend b, Traversable f, Applicative f) =>
(a -> f b) -> AnnSelectStreamG b f a -> f (AnnSelectStreamG b f 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 =>
AnnSelectStreamG b f (m a) -> m (AnnSelectStreamG b f a)
forall (f :: * -> *) a.
Applicative f =>
AnnSelectStreamG b f (f a) -> f (AnnSelectStreamG b f a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnSelectStreamG b f a -> m (AnnSelectStreamG b f b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnSelectStreamG b f a -> f (AnnSelectStreamG b f b)
sequence :: AnnSelectStreamG b f (m a) -> m (AnnSelectStreamG b f a)
$csequence :: forall (b :: BackendType) (f :: * -> *) (m :: * -> *) a.
(Backend b, Traversable f, Monad m) =>
AnnSelectStreamG b f (m a) -> m (AnnSelectStreamG b f a)
mapM :: (a -> m b) -> AnnSelectStreamG b f a -> m (AnnSelectStreamG b f b)
$cmapM :: forall (b :: BackendType) (f :: * -> *) (m :: * -> *) a b.
(Backend b, Traversable f, Monad m) =>
(a -> m b) -> AnnSelectStreamG b f a -> m (AnnSelectStreamG b f b)
sequenceA :: AnnSelectStreamG b f (f a) -> f (AnnSelectStreamG b f a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) (f :: * -> *) a.
(Backend b, Traversable f, Applicative f) =>
AnnSelectStreamG b f (f a) -> f (AnnSelectStreamG b f a)
traverse :: (a -> f b) -> AnnSelectStreamG b f a -> f (AnnSelectStreamG b f b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) (f :: * -> *) a b.
(Backend b, Traversable f, Applicative f) =>
(a -> f b) -> AnnSelectStreamG b f a -> f (AnnSelectStreamG b f b)
$cp2Traversable :: forall (b :: BackendType) (f :: * -> *).
(Backend b, Traversable f) =>
Foldable (AnnSelectStreamG b f)
$cp1Traversable :: forall (b :: BackendType) (f :: * -> *).
(Backend b, Traversable f) =>
Functor (AnnSelectStreamG b f)
Traversable)

deriving instance
  ( Backend b,
    Eq (SelectFromG b v),
    Eq (TablePermG b v),
    Eq (SelectStreamArgsG b v),
    Eq (f v)
  ) =>
  Eq (AnnSelectStreamG b f v)

deriving instance
  ( Backend b,
    Show (SelectFromG b v),
    Show (TablePermG b v),
    Show (SelectStreamArgsG b v),
    Show (f v)
  ) =>
  Show (AnnSelectStreamG b f v)

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)

-- | We can't write a Bifoldable instance for AnnSelectG because the types don't line up.
-- Instead, we provide this function which can be used to help define Bifoldable instances of other types
-- containing AnnSelectG values.
bifoldMapAnnSelectG :: (Backend b, Bifoldable (f b), Monoid m) => (r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG :: (r -> m) -> (v -> m) -> AnnSelectG b (f b r) v -> m
bifoldMapAnnSelectG r -> m
f v -> m
g AnnSelectG {Fields (f b r v)
Maybe NamingCase
StringifyNumbers
TablePermG b v
SelectArgsG b v
SelectFromG b v
_asnNamingConvention :: Maybe NamingCase
_asnStrfyNum :: StringifyNumbers
_asnArgs :: SelectArgsG b v
_asnPerm :: TablePermG b v
_asnFrom :: SelectFromG b v
_asnFields :: Fields (f b r v)
$sel:_asnNamingConvention:AnnSelectG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectG b f v -> Maybe NamingCase
$sel:_asnStrfyNum:AnnSelectG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectG b f v -> StringifyNumbers
$sel:_asnArgs:AnnSelectG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectG b f v -> SelectArgsG b v
$sel:_asnPerm:AnnSelectG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectG b f v -> TablePermG b v
$sel:_asnFrom:AnnSelectG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectG b f v -> SelectFromG b v
$sel:_asnFields:AnnSelectG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectG b f v -> Fields (f v)
..} =
  ((FieldName, f b r v) -> m) -> Fields (f b r v) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((f b r v -> m) -> (FieldName, f b r v) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((f b r v -> m) -> (FieldName, f b r v) -> m)
-> (f b r v -> m) -> (FieldName, f b r v) -> m
forall a b. (a -> b) -> a -> b
$ (r -> m) -> (v -> m) -> f b r v -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap r -> m
f v -> m
g) Fields (f b r v)
_asnFields
    m -> m -> m
forall a. Semigroup a => a -> a -> a
<> (v -> m) -> SelectFromG b v -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap v -> m
g SelectFromG b v
_asnFrom
    m -> m -> m
forall a. Semigroup a => a -> a -> a
<> (v -> m) -> TablePermG b v -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap v -> m
g TablePermG b v
_asnPerm
    m -> m -> m
forall a. Semigroup a => a -> a -> a
<> (v -> m) -> SelectArgsG b v -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap v -> m
g SelectArgsG b v
_asnArgs

bifoldMapAnnSelectStreamG :: (Backend b, Bifoldable (f b), Monoid m) => (r -> m) -> (v -> m) -> AnnSelectStreamG b (f b r) v -> m
bifoldMapAnnSelectStreamG :: (r -> m) -> (v -> m) -> AnnSelectStreamG b (f b r) v -> m
bifoldMapAnnSelectStreamG r -> m
f v -> m
g AnnSelectStreamG {Fields (f b r v)
StringifyNumbers
XStreamingSubscription b
TablePermG b v
SelectStreamArgsG b v
SelectFromG b v
_assnStrfyNum :: StringifyNumbers
_assnArgs :: SelectStreamArgsG b v
_assnPerm :: TablePermG b v
_assnFrom :: SelectFromG b v
_assnFields :: Fields (f b r v)
_assnXStreamingSubscription :: XStreamingSubscription b
$sel:_assnStrfyNum:AnnSelectStreamG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectStreamG b f v -> StringifyNumbers
$sel:_assnArgs:AnnSelectStreamG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectStreamG b f v -> SelectStreamArgsG b v
$sel:_assnPerm:AnnSelectStreamG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectStreamG b f v -> TablePermG b v
$sel:_assnFrom:AnnSelectStreamG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectStreamG b f v -> SelectFromG b v
$sel:_assnFields:AnnSelectStreamG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectStreamG b f v -> Fields (f v)
$sel:_assnXStreamingSubscription:AnnSelectStreamG :: forall (b :: BackendType) (f :: * -> *) v.
AnnSelectStreamG b f v -> XStreamingSubscription b
..} =
  ((FieldName, f b r v) -> m) -> Fields (f b r v) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((f b r v -> m) -> (FieldName, f b r v) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((f b r v -> m) -> (FieldName, f b r v) -> m)
-> (f b r v -> m) -> (FieldName, f b r v) -> m
forall a b. (a -> b) -> a -> b
$ (r -> m) -> (v -> m) -> f b r v -> m
forall (p :: * -> * -> *) m a b.
(Bifoldable p, Monoid m) =>
(a -> m) -> (b -> m) -> p a b -> m
bifoldMap r -> m
f v -> m
g) Fields (f b r v)
_assnFields
    m -> m -> m
forall a. Semigroup a => a -> a -> a
<> (v -> m) -> SelectFromG b v -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap v -> m
g SelectFromG b v
_assnFrom
    m -> m -> m
forall a. Semigroup a => a -> a -> a
<> (v -> m) -> TablePermG b v -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap v -> m
g TablePermG b v
_assnPerm
    m -> m -> m
forall a. Semigroup a => a -> a -> a
<> (v -> m) -> SelectStreamArgsG b v -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap v -> m
g SelectStreamArgsG b v
_assnArgs

-- Relay select

data ConnectionSelect (b :: BackendType) (r :: Type) v = ConnectionSelect
  { ConnectionSelect b r v -> XRelay b
_csXRelay :: XRelay b,
    ConnectionSelect b r v -> PrimaryKeyColumns b
_csPrimaryKeyColumns :: PrimaryKeyColumns b,
    ConnectionSelect b r v -> Maybe (NonEmpty (ConnectionSplit b v))
_csSplit :: Maybe (NE.NonEmpty (ConnectionSplit b v)),
    ConnectionSelect b r v -> Maybe ConnectionSlice
_csSlice :: Maybe ConnectionSlice,
    ConnectionSelect b r v -> AnnSelectG b (ConnectionField b r) v
_csSelect :: (AnnSelectG b (ConnectionField b r) v)
  }
  deriving stock (a -> ConnectionSelect b r b -> ConnectionSelect b r a
(a -> b) -> ConnectionSelect b r a -> ConnectionSelect b r b
(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
<$ :: a -> ConnectionSelect b r b -> ConnectionSelect b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> ConnectionSelect b r b -> ConnectionSelect b r a
fmap :: (a -> b) -> ConnectionSelect b r a -> ConnectionSelect b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ConnectionSelect b r a -> ConnectionSelect b r b
Functor, ConnectionSelect b r a -> Bool
(a -> m) -> ConnectionSelect b r a -> m
(a -> b -> b) -> b -> ConnectionSelect b r a -> b
(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
product :: ConnectionSelect b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionSelect b r a -> a
sum :: ConnectionSelect b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionSelect b r a -> a
minimum :: ConnectionSelect b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionSelect b r a -> a
maximum :: ConnectionSelect b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionSelect b r a -> a
elem :: a -> ConnectionSelect b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ConnectionSelect b r a -> Bool
length :: ConnectionSelect b r a -> Int
$clength :: forall (b :: BackendType) r a.
Backend b =>
ConnectionSelect b r a -> Int
null :: ConnectionSelect b r a -> Bool
$cnull :: forall (b :: BackendType) r a.
Backend b =>
ConnectionSelect b r a -> Bool
toList :: ConnectionSelect b r a -> [a]
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
ConnectionSelect b r a -> [a]
foldl1 :: (a -> a -> a) -> ConnectionSelect b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionSelect b r a -> a
foldr1 :: (a -> a -> a) -> ConnectionSelect b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionSelect b r a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: ConnectionSelect b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ConnectionSelect b r m -> m
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)
(a -> f b) -> ConnectionSelect b r a -> f (ConnectionSelect b r b)
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)
sequence :: ConnectionSelect b r (m a) -> m (ConnectionSelect b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ConnectionSelect b r (m a) -> m (ConnectionSelect b r a)
mapM :: (a -> m b) -> ConnectionSelect b r a -> m (ConnectionSelect b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ConnectionSelect b r a -> m (ConnectionSelect b r b)
sequenceA :: ConnectionSelect b r (f a) -> f (ConnectionSelect b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ConnectionSelect b r (f a) -> f (ConnectionSelect b r a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType) r.
Backend b =>
Foldable (ConnectionSelect b r)
$cp1Traversable :: forall (b :: BackendType) r.
Backend b =>
Functor (ConnectionSelect b r)
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 :: (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
_csSelect :: AnnSelectG b (ConnectionField b a) b
_csSlice :: Maybe ConnectionSlice
_csSplit :: Maybe (NonEmpty (ConnectionSplit b b))
_csPrimaryKeyColumns :: PrimaryKeyColumns b
_csXRelay :: XRelay b
$sel:_csSelect:ConnectionSelect :: forall (b :: BackendType) r v.
ConnectionSelect b r v -> AnnSelectG b (ConnectionField b r) v
$sel:_csSlice:ConnectionSelect :: forall (b :: BackendType) r v.
ConnectionSelect b r v -> Maybe ConnectionSlice
$sel:_csSplit:ConnectionSelect :: forall (b :: BackendType) r v.
ConnectionSelect b r v -> Maybe (NonEmpty (ConnectionSplit b v))
$sel:_csPrimaryKeyColumns:ConnectionSelect :: forall (b :: BackendType) r v.
ConnectionSelect b r v -> PrimaryKeyColumns b
$sel:_csXRelay:ConnectionSelect :: forall (b :: BackendType) r v. ConnectionSelect b r v -> XRelay b
..} =
    (NonEmpty (ConnectionSplit b b) -> m)
-> Maybe (NonEmpty (ConnectionSplit b b)) -> 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 (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 (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
  { ConnectionSplit b v -> ConnectionSplitKind
_csKind :: ConnectionSplitKind,
    ConnectionSplit b v -> v
_csValue :: v,
    ConnectionSplit b v -> OrderByItemG b (AnnotatedOrderByElement b v)
_csOrderBy :: (OrderByItemG b (AnnotatedOrderByElement b v))
  }
  deriving stock (a -> ConnectionSplit b b -> ConnectionSplit b a
(a -> b) -> ConnectionSplit b a -> ConnectionSplit b b
(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
<$ :: a -> ConnectionSplit b b -> ConnectionSplit b a
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> ConnectionSplit b b -> ConnectionSplit b a
fmap :: (a -> b) -> ConnectionSplit b a -> ConnectionSplit b b
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> ConnectionSplit b a -> ConnectionSplit b b
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
$cto :: forall (b :: BackendType) v x.
Rep (ConnectionSplit b v) x -> ConnectionSplit b v
$cfrom :: forall (b :: BackendType) v x.
ConnectionSplit b v -> Rep (ConnectionSplit b v) x
Generic, ConnectionSplit b a -> Bool
(a -> m) -> ConnectionSplit b a -> m
(a -> b -> b) -> b -> ConnectionSplit b a -> b
(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
product :: ConnectionSplit b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
ConnectionSplit b a -> a
sum :: ConnectionSplit b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
ConnectionSplit b a -> a
minimum :: ConnectionSplit b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
ConnectionSplit b a -> a
maximum :: ConnectionSplit b a -> a
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
ConnectionSplit b a -> a
elem :: a -> ConnectionSplit b a -> Bool
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> ConnectionSplit b a -> Bool
length :: ConnectionSplit b a -> Int
$clength :: forall (b :: BackendType) a.
Backend b =>
ConnectionSplit b a -> Int
null :: ConnectionSplit b a -> Bool
$cnull :: forall (b :: BackendType) a.
Backend b =>
ConnectionSplit b a -> Bool
toList :: ConnectionSplit b a -> [a]
$ctoList :: forall (b :: BackendType) a.
Backend b =>
ConnectionSplit b a -> [a]
foldl1 :: (a -> a -> a) -> ConnectionSplit b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ConnectionSplit b a -> a
foldr1 :: (a -> a -> a) -> ConnectionSplit b a -> a
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ConnectionSplit b a -> a
foldl' :: (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 :: (b -> a -> b) -> b -> ConnectionSplit b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ConnectionSplit b a -> b
foldr' :: (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 :: (a -> b -> b) -> b -> ConnectionSplit b a -> b
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ConnectionSplit b a -> b
foldMap' :: (a -> m) -> ConnectionSplit b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionSplit b a -> m
foldMap :: (a -> m) -> ConnectionSplit b a -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ConnectionSplit b a -> m
fold :: ConnectionSplit b m -> m
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
ConnectionSplit b m -> m
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)
(a -> f b) -> ConnectionSplit b a -> f (ConnectionSplit b 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)
sequence :: ConnectionSplit b (m a) -> m (ConnectionSplit b a)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
ConnectionSplit b (m a) -> m (ConnectionSplit b a)
mapM :: (a -> m b) -> ConnectionSplit b a -> m (ConnectionSplit b b)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ConnectionSplit b a -> m (ConnectionSplit b b)
sequenceA :: ConnectionSplit b (f a) -> f (ConnectionSplit b a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
ConnectionSplit b (f a) -> f (ConnectionSplit b a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType).
Backend b =>
Foldable (ConnectionSplit b)
$cp1Traversable :: forall (b :: BackendType). Backend b => Functor (ConnectionSplit b)
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
showList :: [ConnectionSlice] -> ShowS
$cshowList :: [ConnectionSlice] -> ShowS
show :: ConnectionSlice -> String
$cshow :: ConnectionSlice -> String
showsPrec :: Int -> ConnectionSlice -> ShowS
$cshowsPrec :: Int -> ConnectionSlice -> ShowS
Show, ConnectionSlice -> ConnectionSlice -> Bool
(ConnectionSlice -> ConnectionSlice -> Bool)
-> (ConnectionSlice -> ConnectionSlice -> Bool)
-> Eq ConnectionSlice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionSlice -> ConnectionSlice -> Bool
$c/= :: ConnectionSlice -> ConnectionSlice -> Bool
== :: ConnectionSlice -> ConnectionSlice -> Bool
$c== :: 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
$cto :: forall x. Rep ConnectionSlice x -> ConnectionSlice
$cfrom :: forall x. ConnectionSlice -> Rep ConnectionSlice x
Generic)
  deriving anyclass (Int -> ConnectionSlice -> Int
ConnectionSlice -> Int
(Int -> ConnectionSlice -> Int)
-> (ConnectionSlice -> Int) -> Hashable ConnectionSlice
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ConnectionSlice -> Int
$chash :: ConnectionSlice -> Int
hashWithSalt :: Int -> ConnectionSlice -> Int
$chashWithSalt :: Int -> 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
showList :: [ConnectionSplitKind] -> ShowS
$cshowList :: [ConnectionSplitKind] -> ShowS
show :: ConnectionSplitKind -> String
$cshow :: ConnectionSplitKind -> String
showsPrec :: Int -> ConnectionSplitKind -> ShowS
$cshowsPrec :: Int -> ConnectionSplitKind -> ShowS
Show, ConnectionSplitKind -> ConnectionSplitKind -> Bool
(ConnectionSplitKind -> ConnectionSplitKind -> Bool)
-> (ConnectionSplitKind -> ConnectionSplitKind -> Bool)
-> Eq ConnectionSplitKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionSplitKind -> ConnectionSplitKind -> Bool
$c/= :: ConnectionSplitKind -> ConnectionSplitKind -> Bool
== :: ConnectionSplitKind -> ConnectionSplitKind -> Bool
$c== :: 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
$cto :: forall x. Rep ConnectionSplitKind x -> ConnectionSplitKind
$cfrom :: forall x. ConnectionSplitKind -> Rep ConnectionSplitKind x
Generic)
  deriving anyclass (Int -> ConnectionSplitKind -> Int
ConnectionSplitKind -> Int
(Int -> ConnectionSplitKind -> Int)
-> (ConnectionSplitKind -> Int) -> Hashable ConnectionSplitKind
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ConnectionSplitKind -> Int
$chash :: ConnectionSplitKind -> Int
hashWithSalt :: Int -> ConnectionSplitKind -> Int
$chashWithSalt :: Int -> ConnectionSplitKind -> Int
Hashable)

-- From

-- | Identifier used exclusively as the argument to 'FromIdentifier'
newtype FIIdentifier = FIIdentifier
  { FIIdentifier -> Text
unFIIdentifier :: Text
  }
  deriving stock ((forall x. FIIdentifier -> Rep FIIdentifier x)
-> (forall x. Rep FIIdentifier x -> FIIdentifier)
-> Generic FIIdentifier
forall x. Rep FIIdentifier x -> FIIdentifier
forall x. FIIdentifier -> Rep FIIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FIIdentifier x -> FIIdentifier
$cfrom :: forall x. FIIdentifier -> Rep FIIdentifier x
Generic)
  deriving newtype (FIIdentifier -> FIIdentifier -> Bool
(FIIdentifier -> FIIdentifier -> Bool)
-> (FIIdentifier -> FIIdentifier -> Bool) -> Eq FIIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FIIdentifier -> FIIdentifier -> Bool
$c/= :: FIIdentifier -> FIIdentifier -> Bool
== :: FIIdentifier -> FIIdentifier -> Bool
$c== :: FIIdentifier -> FIIdentifier -> Bool
Eq, Int -> FIIdentifier -> ShowS
[FIIdentifier] -> ShowS
FIIdentifier -> String
(Int -> FIIdentifier -> ShowS)
-> (FIIdentifier -> String)
-> ([FIIdentifier] -> ShowS)
-> Show FIIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FIIdentifier] -> ShowS
$cshowList :: [FIIdentifier] -> ShowS
show :: FIIdentifier -> String
$cshow :: FIIdentifier -> String
showsPrec :: Int -> FIIdentifier -> ShowS
$cshowsPrec :: Int -> FIIdentifier -> ShowS
Show)
  deriving anyclass (Int -> FIIdentifier -> Int
FIIdentifier -> Int
(Int -> FIIdentifier -> Int)
-> (FIIdentifier -> Int) -> Hashable FIIdentifier
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: FIIdentifier -> Int
$chash :: FIIdentifier -> Int
hashWithSalt :: Int -> FIIdentifier -> Int
$chashWithSalt :: Int -> FIIdentifier -> Int
Hashable)

instance PG.IsIdentifier FIIdentifier where
  toIdentifier :: FIIdentifier -> Identifier
toIdentifier = FIIdentifier -> Identifier
coerce
  {-# INLINE toIdentifier #-}

data SelectFromG (b :: BackendType) v
  = FromTable (TableName b)
  | FromIdentifier FIIdentifier
  | FromFunction
      (FunctionName b)
      (FunctionArgsExp b v)
      -- a definition list
      (Maybe [(Column b, ScalarType b)])
  deriving stock ((forall x. SelectFromG b v -> Rep (SelectFromG b v) x)
-> (forall x. Rep (SelectFromG b v) x -> SelectFromG b v)
-> Generic (SelectFromG b v)
forall x. Rep (SelectFromG b v) x -> SelectFromG b v
forall x. SelectFromG b v -> Rep (SelectFromG 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 (SelectFromG b v) x -> SelectFromG b v
forall (b :: BackendType) v x.
SelectFromG b v -> Rep (SelectFromG b v) x
$cto :: forall (b :: BackendType) v x.
Rep (SelectFromG b v) x -> SelectFromG b v
$cfrom :: forall (b :: BackendType) v x.
SelectFromG b v -> Rep (SelectFromG b v) x
Generic)

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

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

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

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

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

instance (Backend b, Hashable v, Hashable (FunctionArgumentExp b v)) => Hashable (SelectFromG b v)

type SelectFrom b = SelectFromG b (SQLExpression b)

-- Select arguments

data SelectStreamArgsG (b :: BackendType) v = SelectStreamArgsG
  { -- | optional filter to filter the stream results
    SelectStreamArgsG b v -> Maybe (AnnBoolExp b v)
_ssaWhere :: Maybe (AnnBoolExp b v),
    -- | maximum number of rows to be returned in a single fetch
    SelectStreamArgsG b v -> Int
_ssaBatchSize :: Int,
    -- | info related to the cursor column, a single item data type
    --   currently because only single column cursors are supported
    SelectStreamArgsG b v -> StreamCursorItem b
_ssaCursorArg :: StreamCursorItem b
  }
  deriving ((forall x. SelectStreamArgsG b v -> Rep (SelectStreamArgsG b v) x)
-> (forall x.
    Rep (SelectStreamArgsG b v) x -> SelectStreamArgsG b v)
-> Generic (SelectStreamArgsG b v)
forall x. Rep (SelectStreamArgsG b v) x -> SelectStreamArgsG b v
forall x. SelectStreamArgsG b v -> Rep (SelectStreamArgsG 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 (SelectStreamArgsG b v) x -> SelectStreamArgsG b v
forall (b :: BackendType) v x.
SelectStreamArgsG b v -> Rep (SelectStreamArgsG b v) x
$cto :: forall (b :: BackendType) v x.
Rep (SelectStreamArgsG b v) x -> SelectStreamArgsG b v
$cfrom :: forall (b :: BackendType) v x.
SelectStreamArgsG b v -> Rep (SelectStreamArgsG b v) x
Generic, a -> SelectStreamArgsG b b -> SelectStreamArgsG b a
(a -> b) -> SelectStreamArgsG b a -> SelectStreamArgsG b b
(forall a b.
 (a -> b) -> SelectStreamArgsG b a -> SelectStreamArgsG b b)
-> (forall a b.
    a -> SelectStreamArgsG b b -> SelectStreamArgsG b a)
-> Functor (SelectStreamArgsG b)
forall a b. a -> SelectStreamArgsG b b -> SelectStreamArgsG b a
forall a b.
(a -> b) -> SelectStreamArgsG b a -> SelectStreamArgsG b b
forall (b :: BackendType) a b.
Backend b =>
a -> SelectStreamArgsG b b -> SelectStreamArgsG b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> SelectStreamArgsG b a -> SelectStreamArgsG b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> SelectStreamArgsG b b -> SelectStreamArgsG b a
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> SelectStreamArgsG b b -> SelectStreamArgsG b a
fmap :: (a -> b) -> SelectStreamArgsG b a -> SelectStreamArgsG b b
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> SelectStreamArgsG b a -> SelectStreamArgsG b b
Functor, SelectStreamArgsG b a -> Bool
(a -> m) -> SelectStreamArgsG b a -> m
(a -> b -> b) -> b -> SelectStreamArgsG b a -> b
(forall m. Monoid m => SelectStreamArgsG b m -> m)
-> (forall m a. Monoid m => (a -> m) -> SelectStreamArgsG b a -> m)
-> (forall m a. Monoid m => (a -> m) -> SelectStreamArgsG b a -> m)
-> (forall a b. (a -> b -> b) -> b -> SelectStreamArgsG b a -> b)
-> (forall a b. (a -> b -> b) -> b -> SelectStreamArgsG b a -> b)
-> (forall b a. (b -> a -> b) -> b -> SelectStreamArgsG b a -> b)
-> (forall b a. (b -> a -> b) -> b -> SelectStreamArgsG b a -> b)
-> (forall a. (a -> a -> a) -> SelectStreamArgsG b a -> a)
-> (forall a. (a -> a -> a) -> SelectStreamArgsG b a -> a)
-> (forall a. SelectStreamArgsG b a -> [a])
-> (forall a. SelectStreamArgsG b a -> Bool)
-> (forall a. SelectStreamArgsG b a -> Int)
-> (forall a. Eq a => a -> SelectStreamArgsG b a -> Bool)
-> (forall a. Ord a => SelectStreamArgsG b a -> a)
-> (forall a. Ord a => SelectStreamArgsG b a -> a)
-> (forall a. Num a => SelectStreamArgsG b a -> a)
-> (forall a. Num a => SelectStreamArgsG b a -> a)
-> Foldable (SelectStreamArgsG b)
forall a. Eq a => a -> SelectStreamArgsG b a -> Bool
forall a. Num a => SelectStreamArgsG b a -> a
forall a. Ord a => SelectStreamArgsG b a -> a
forall m. Monoid m => SelectStreamArgsG b m -> m
forall a. SelectStreamArgsG b a -> Bool
forall a. SelectStreamArgsG b a -> Int
forall a. SelectStreamArgsG b a -> [a]
forall a. (a -> a -> a) -> SelectStreamArgsG b a -> a
forall m a. Monoid m => (a -> m) -> SelectStreamArgsG b a -> m
forall b a. (b -> a -> b) -> b -> SelectStreamArgsG b a -> b
forall a b. (a -> b -> b) -> b -> SelectStreamArgsG b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> SelectStreamArgsG b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
SelectStreamArgsG b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
SelectStreamArgsG b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
SelectStreamArgsG b m -> m
forall (b :: BackendType) a.
Backend b =>
SelectStreamArgsG b a -> Bool
forall (b :: BackendType) a.
Backend b =>
SelectStreamArgsG b a -> Int
forall (b :: BackendType) a.
Backend b =>
SelectStreamArgsG b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> SelectStreamArgsG b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> SelectStreamArgsG b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> SelectStreamArgsG b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> SelectStreamArgsG 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
product :: SelectStreamArgsG b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
SelectStreamArgsG b a -> a
sum :: SelectStreamArgsG b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
SelectStreamArgsG b a -> a
minimum :: SelectStreamArgsG b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
SelectStreamArgsG b a -> a
maximum :: SelectStreamArgsG b a -> a
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
SelectStreamArgsG b a -> a
elem :: a -> SelectStreamArgsG b a -> Bool
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> SelectStreamArgsG b a -> Bool
length :: SelectStreamArgsG b a -> Int
$clength :: forall (b :: BackendType) a.
Backend b =>
SelectStreamArgsG b a -> Int
null :: SelectStreamArgsG b a -> Bool
$cnull :: forall (b :: BackendType) a.
Backend b =>
SelectStreamArgsG b a -> Bool
toList :: SelectStreamArgsG b a -> [a]
$ctoList :: forall (b :: BackendType) a.
Backend b =>
SelectStreamArgsG b a -> [a]
foldl1 :: (a -> a -> a) -> SelectStreamArgsG b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> SelectStreamArgsG b a -> a
foldr1 :: (a -> a -> a) -> SelectStreamArgsG b a -> a
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> SelectStreamArgsG b a -> a
foldl' :: (b -> a -> b) -> b -> SelectStreamArgsG b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> SelectStreamArgsG b a -> b
foldl :: (b -> a -> b) -> b -> SelectStreamArgsG b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> SelectStreamArgsG b a -> b
foldr' :: (a -> b -> b) -> b -> SelectStreamArgsG b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> SelectStreamArgsG b a -> b
foldr :: (a -> b -> b) -> b -> SelectStreamArgsG b a -> b
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> SelectStreamArgsG b a -> b
foldMap' :: (a -> m) -> SelectStreamArgsG b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> SelectStreamArgsG b a -> m
foldMap :: (a -> m) -> SelectStreamArgsG b a -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> SelectStreamArgsG b a -> m
fold :: SelectStreamArgsG b m -> m
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
SelectStreamArgsG b m -> m
Foldable, Functor (SelectStreamArgsG b)
Foldable (SelectStreamArgsG b)
Functor (SelectStreamArgsG b)
-> Foldable (SelectStreamArgsG b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> SelectStreamArgsG b a -> f (SelectStreamArgsG b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    SelectStreamArgsG b (f a) -> f (SelectStreamArgsG b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> SelectStreamArgsG b a -> m (SelectStreamArgsG b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    SelectStreamArgsG b (m a) -> m (SelectStreamArgsG b a))
-> Traversable (SelectStreamArgsG b)
(a -> f b) -> SelectStreamArgsG b a -> f (SelectStreamArgsG b b)
forall (b :: BackendType).
Backend b =>
Functor (SelectStreamArgsG b)
forall (b :: BackendType).
Backend b =>
Foldable (SelectStreamArgsG b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
SelectStreamArgsG b (m a) -> m (SelectStreamArgsG b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
SelectStreamArgsG b (f a) -> f (SelectStreamArgsG b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> SelectStreamArgsG b a -> m (SelectStreamArgsG b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> SelectStreamArgsG b a -> f (SelectStreamArgsG 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 =>
SelectStreamArgsG b (m a) -> m (SelectStreamArgsG b a)
forall (f :: * -> *) a.
Applicative f =>
SelectStreamArgsG b (f a) -> f (SelectStreamArgsG b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> SelectStreamArgsG b a -> m (SelectStreamArgsG b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> SelectStreamArgsG b a -> f (SelectStreamArgsG b b)
sequence :: SelectStreamArgsG b (m a) -> m (SelectStreamArgsG b a)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
SelectStreamArgsG b (m a) -> m (SelectStreamArgsG b a)
mapM :: (a -> m b) -> SelectStreamArgsG b a -> m (SelectStreamArgsG b b)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> SelectStreamArgsG b a -> m (SelectStreamArgsG b b)
sequenceA :: SelectStreamArgsG b (f a) -> f (SelectStreamArgsG b a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
SelectStreamArgsG b (f a) -> f (SelectStreamArgsG b a)
traverse :: (a -> f b) -> SelectStreamArgsG b a -> f (SelectStreamArgsG b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> SelectStreamArgsG b a -> f (SelectStreamArgsG b b)
$cp2Traversable :: forall (b :: BackendType).
Backend b =>
Foldable (SelectStreamArgsG b)
$cp1Traversable :: forall (b :: BackendType).
Backend b =>
Functor (SelectStreamArgsG b)
Traversable)

type SelectStreamArgs b = SelectStreamArgsG b (SQLExpression b)

deriving instance
  ( Backend b,
    Eq (AnnBoolExp b v),
    Eq v
  ) =>
  Eq (SelectStreamArgsG b v)

deriving instance
  ( Backend b,
    Show (AnnBoolExp b v),
    Show v
  ) =>
  Show (SelectStreamArgsG b v)

data SelectArgsG (b :: BackendType) v = SelectArgs
  { SelectArgsG b v -> Maybe (AnnBoolExp b v)
_saWhere :: Maybe (AnnBoolExp b v),
    SelectArgsG b v -> Maybe (NonEmpty (AnnotatedOrderByItemG b v))
_saOrderBy :: Maybe (NE.NonEmpty (AnnotatedOrderByItemG b v)),
    SelectArgsG b v -> Maybe Int
_saLimit :: Maybe Int,
    SelectArgsG b v -> Maybe Int64
_saOffset :: Maybe Int64,
    SelectArgsG b v -> Maybe (NonEmpty (Column b))
_saDistinct :: (Maybe (NE.NonEmpty (Column b)))
  }
  deriving stock ((forall x. SelectArgsG b v -> Rep (SelectArgsG b v) x)
-> (forall x. Rep (SelectArgsG b v) x -> SelectArgsG b v)
-> Generic (SelectArgsG b v)
forall x. Rep (SelectArgsG b v) x -> SelectArgsG b v
forall x. SelectArgsG b v -> Rep (SelectArgsG 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 (SelectArgsG b v) x -> SelectArgsG b v
forall (b :: BackendType) v x.
SelectArgsG b v -> Rep (SelectArgsG b v) x
$cto :: forall (b :: BackendType) v x.
Rep (SelectArgsG b v) x -> SelectArgsG b v
$cfrom :: forall (b :: BackendType) v x.
SelectArgsG b v -> Rep (SelectArgsG b v) x
Generic, a -> SelectArgsG b b -> SelectArgsG b a
(a -> b) -> SelectArgsG b a -> SelectArgsG b b
(forall a b. (a -> b) -> SelectArgsG b a -> SelectArgsG b b)
-> (forall a b. a -> SelectArgsG b b -> SelectArgsG b a)
-> Functor (SelectArgsG b)
forall a b. a -> SelectArgsG b b -> SelectArgsG b a
forall a b. (a -> b) -> SelectArgsG b a -> SelectArgsG b b
forall (b :: BackendType) a b.
Backend b =>
a -> SelectArgsG b b -> SelectArgsG b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> SelectArgsG b a -> SelectArgsG b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> SelectArgsG b b -> SelectArgsG b a
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> SelectArgsG b b -> SelectArgsG b a
fmap :: (a -> b) -> SelectArgsG b a -> SelectArgsG b b
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> SelectArgsG b a -> SelectArgsG b b
Functor, SelectArgsG b a -> Bool
(a -> m) -> SelectArgsG b a -> m
(a -> b -> b) -> b -> SelectArgsG b a -> b
(forall m. Monoid m => SelectArgsG b m -> m)
-> (forall m a. Monoid m => (a -> m) -> SelectArgsG b a -> m)
-> (forall m a. Monoid m => (a -> m) -> SelectArgsG b a -> m)
-> (forall a b. (a -> b -> b) -> b -> SelectArgsG b a -> b)
-> (forall a b. (a -> b -> b) -> b -> SelectArgsG b a -> b)
-> (forall b a. (b -> a -> b) -> b -> SelectArgsG b a -> b)
-> (forall b a. (b -> a -> b) -> b -> SelectArgsG b a -> b)
-> (forall a. (a -> a -> a) -> SelectArgsG b a -> a)
-> (forall a. (a -> a -> a) -> SelectArgsG b a -> a)
-> (forall a. SelectArgsG b a -> [a])
-> (forall a. SelectArgsG b a -> Bool)
-> (forall a. SelectArgsG b a -> Int)
-> (forall a. Eq a => a -> SelectArgsG b a -> Bool)
-> (forall a. Ord a => SelectArgsG b a -> a)
-> (forall a. Ord a => SelectArgsG b a -> a)
-> (forall a. Num a => SelectArgsG b a -> a)
-> (forall a. Num a => SelectArgsG b a -> a)
-> Foldable (SelectArgsG b)
forall a. Eq a => a -> SelectArgsG b a -> Bool
forall a. Num a => SelectArgsG b a -> a
forall a. Ord a => SelectArgsG b a -> a
forall m. Monoid m => SelectArgsG b m -> m
forall a. SelectArgsG b a -> Bool
forall a. SelectArgsG b a -> Int
forall a. SelectArgsG b a -> [a]
forall a. (a -> a -> a) -> SelectArgsG b a -> a
forall m a. Monoid m => (a -> m) -> SelectArgsG b a -> m
forall b a. (b -> a -> b) -> b -> SelectArgsG b a -> b
forall a b. (a -> b -> b) -> b -> SelectArgsG b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> SelectArgsG b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
SelectArgsG b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
SelectArgsG b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
SelectArgsG b m -> m
forall (b :: BackendType) a. Backend b => SelectArgsG b a -> Bool
forall (b :: BackendType) a. Backend b => SelectArgsG b a -> Int
forall (b :: BackendType) a. Backend b => SelectArgsG b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> SelectArgsG b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> SelectArgsG b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> SelectArgsG b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> SelectArgsG 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
product :: SelectArgsG b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
SelectArgsG b a -> a
sum :: SelectArgsG b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
SelectArgsG b a -> a
minimum :: SelectArgsG b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
SelectArgsG b a -> a
maximum :: SelectArgsG b a -> a
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
SelectArgsG b a -> a
elem :: a -> SelectArgsG b a -> Bool
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> SelectArgsG b a -> Bool
length :: SelectArgsG b a -> Int
$clength :: forall (b :: BackendType) a. Backend b => SelectArgsG b a -> Int
null :: SelectArgsG b a -> Bool
$cnull :: forall (b :: BackendType) a. Backend b => SelectArgsG b a -> Bool
toList :: SelectArgsG b a -> [a]
$ctoList :: forall (b :: BackendType) a. Backend b => SelectArgsG b a -> [a]
foldl1 :: (a -> a -> a) -> SelectArgsG b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> SelectArgsG b a -> a
foldr1 :: (a -> a -> a) -> SelectArgsG b a -> a
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> SelectArgsG b a -> a
foldl' :: (b -> a -> b) -> b -> SelectArgsG b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> SelectArgsG b a -> b
foldl :: (b -> a -> b) -> b -> SelectArgsG b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> SelectArgsG b a -> b
foldr' :: (a -> b -> b) -> b -> SelectArgsG b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> SelectArgsG b a -> b
foldr :: (a -> b -> b) -> b -> SelectArgsG b a -> b
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> SelectArgsG b a -> b
foldMap' :: (a -> m) -> SelectArgsG b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> SelectArgsG b a -> m
foldMap :: (a -> m) -> SelectArgsG b a -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> SelectArgsG b a -> m
fold :: SelectArgsG b m -> m
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
SelectArgsG b m -> m
Foldable, Functor (SelectArgsG b)
Foldable (SelectArgsG b)
Functor (SelectArgsG b)
-> Foldable (SelectArgsG b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> SelectArgsG b a -> f (SelectArgsG b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    SelectArgsG b (f a) -> f (SelectArgsG b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> SelectArgsG b a -> m (SelectArgsG b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    SelectArgsG b (m a) -> m (SelectArgsG b a))
-> Traversable (SelectArgsG b)
(a -> f b) -> SelectArgsG b a -> f (SelectArgsG b b)
forall (b :: BackendType). Backend b => Functor (SelectArgsG b)
forall (b :: BackendType). Backend b => Foldable (SelectArgsG b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
SelectArgsG b (m a) -> m (SelectArgsG b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
SelectArgsG b (f a) -> f (SelectArgsG b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> SelectArgsG b a -> m (SelectArgsG b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> SelectArgsG b a -> f (SelectArgsG 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 =>
SelectArgsG b (m a) -> m (SelectArgsG b a)
forall (f :: * -> *) a.
Applicative f =>
SelectArgsG b (f a) -> f (SelectArgsG b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> SelectArgsG b a -> m (SelectArgsG b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> SelectArgsG b a -> f (SelectArgsG b b)
sequence :: SelectArgsG b (m a) -> m (SelectArgsG b a)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
SelectArgsG b (m a) -> m (SelectArgsG b a)
mapM :: (a -> m b) -> SelectArgsG b a -> m (SelectArgsG b b)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> SelectArgsG b a -> m (SelectArgsG b b)
sequenceA :: SelectArgsG b (f a) -> f (SelectArgsG b a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
SelectArgsG b (f a) -> f (SelectArgsG b a)
traverse :: (a -> f b) -> SelectArgsG b a -> f (SelectArgsG b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> SelectArgsG b a -> f (SelectArgsG b b)
$cp2Traversable :: forall (b :: BackendType). Backend b => Foldable (SelectArgsG b)
$cp1Traversable :: forall (b :: BackendType). Backend b => Functor (SelectArgsG b)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AnnBoolExp b v),
    Eq (AnnotatedOrderByItemG b v)
  ) =>
  Eq (SelectArgsG b v)

instance
  ( Backend b,
    Hashable (AnnBoolExp b v),
    Hashable (AnnotatedOrderByItemG b v)
  ) =>
  Hashable (SelectArgsG b v)

deriving stock instance
  ( Backend b,
    Show (AnnBoolExp b v),
    Show (AnnotatedOrderByItemG b v)
  ) =>
  Show (SelectArgsG b v)

type SelectArgs b = SelectArgsG b (SQLExpression b)

noSelectArgs :: SelectArgsG backend v
noSelectArgs :: SelectArgsG backend v
noSelectArgs = Maybe (AnnBoolExp backend v)
-> Maybe (NonEmpty (AnnotatedOrderByItemG backend v))
-> Maybe Int
-> Maybe Int64
-> Maybe (NonEmpty (Column backend))
-> SelectArgsG backend v
forall (b :: BackendType) v.
Maybe (AnnBoolExp b v)
-> Maybe (NonEmpty (AnnotatedOrderByItemG b v))
-> Maybe Int
-> Maybe Int64
-> Maybe (NonEmpty (Column b))
-> SelectArgsG b v
SelectArgs Maybe (AnnBoolExp backend v)
forall a. Maybe a
Nothing Maybe (NonEmpty (AnnotatedOrderByItemG backend v))
forall a. Maybe a
Nothing Maybe Int
forall a. Maybe a
Nothing Maybe Int64
forall a. Maybe a
Nothing Maybe (NonEmpty (Column backend))
forall a. Maybe a
Nothing

-- Order by argument

-- | The order by element for a computed field based on its return type
data ComputedFieldOrderByElement (b :: BackendType) v
  = -- | Sort by the scalar computed field
    CFOBEScalar (ScalarType b)
  | CFOBETableAggregation
      (TableName b)
      (AnnBoolExp b v)
      -- ^ Permission filter of the retuning table
      (AnnotatedAggregateOrderBy b)
      -- ^ Sort by aggregation fields of table rows returned by computed field
  deriving stock ((forall x.
 ComputedFieldOrderByElement b v
 -> Rep (ComputedFieldOrderByElement b v) x)
-> (forall x.
    Rep (ComputedFieldOrderByElement b v) x
    -> ComputedFieldOrderByElement b v)
-> Generic (ComputedFieldOrderByElement b v)
forall x.
Rep (ComputedFieldOrderByElement b v) x
-> ComputedFieldOrderByElement b v
forall x.
ComputedFieldOrderByElement b v
-> Rep (ComputedFieldOrderByElement 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 (ComputedFieldOrderByElement b v) x
-> ComputedFieldOrderByElement b v
forall (b :: BackendType) v x.
ComputedFieldOrderByElement b v
-> Rep (ComputedFieldOrderByElement b v) x
$cto :: forall (b :: BackendType) v x.
Rep (ComputedFieldOrderByElement b v) x
-> ComputedFieldOrderByElement b v
$cfrom :: forall (b :: BackendType) v x.
ComputedFieldOrderByElement b v
-> Rep (ComputedFieldOrderByElement b v) x
Generic, a
-> ComputedFieldOrderByElement b b
-> ComputedFieldOrderByElement b a
(a -> b)
-> ComputedFieldOrderByElement b a
-> ComputedFieldOrderByElement b b
(forall a b.
 (a -> b)
 -> ComputedFieldOrderByElement b a
 -> ComputedFieldOrderByElement b b)
-> (forall a b.
    a
    -> ComputedFieldOrderByElement b b
    -> ComputedFieldOrderByElement b a)
-> Functor (ComputedFieldOrderByElement b)
forall a b.
a
-> ComputedFieldOrderByElement b b
-> ComputedFieldOrderByElement b a
forall a b.
(a -> b)
-> ComputedFieldOrderByElement b a
-> ComputedFieldOrderByElement b b
forall (b :: BackendType) a b.
Backend b =>
a
-> ComputedFieldOrderByElement b b
-> ComputedFieldOrderByElement b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b)
-> ComputedFieldOrderByElement b a
-> ComputedFieldOrderByElement b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a
-> ComputedFieldOrderByElement b b
-> ComputedFieldOrderByElement b a
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a
-> ComputedFieldOrderByElement b b
-> ComputedFieldOrderByElement b a
fmap :: (a -> b)
-> ComputedFieldOrderByElement b a
-> ComputedFieldOrderByElement b b
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b)
-> ComputedFieldOrderByElement b a
-> ComputedFieldOrderByElement b b
Functor, ComputedFieldOrderByElement b a -> Bool
(a -> m) -> ComputedFieldOrderByElement b a -> m
(a -> b -> b) -> b -> ComputedFieldOrderByElement b a -> b
(forall m. Monoid m => ComputedFieldOrderByElement b m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> ComputedFieldOrderByElement b a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> ComputedFieldOrderByElement b a -> m)
-> (forall a b.
    (a -> b -> b) -> b -> ComputedFieldOrderByElement b a -> b)
-> (forall a b.
    (a -> b -> b) -> b -> ComputedFieldOrderByElement b a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> ComputedFieldOrderByElement b a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> ComputedFieldOrderByElement b a -> b)
-> (forall a.
    (a -> a -> a) -> ComputedFieldOrderByElement b a -> a)
-> (forall a.
    (a -> a -> a) -> ComputedFieldOrderByElement b a -> a)
-> (forall a. ComputedFieldOrderByElement b a -> [a])
-> (forall a. ComputedFieldOrderByElement b a -> Bool)
-> (forall a. ComputedFieldOrderByElement b a -> Int)
-> (forall a. Eq a => a -> ComputedFieldOrderByElement b a -> Bool)
-> (forall a. Ord a => ComputedFieldOrderByElement b a -> a)
-> (forall a. Ord a => ComputedFieldOrderByElement b a -> a)
-> (forall a. Num a => ComputedFieldOrderByElement b a -> a)
-> (forall a. Num a => ComputedFieldOrderByElement b a -> a)
-> Foldable (ComputedFieldOrderByElement b)
forall a. Eq a => a -> ComputedFieldOrderByElement b a -> Bool
forall a. Num a => ComputedFieldOrderByElement b a -> a
forall a. Ord a => ComputedFieldOrderByElement b a -> a
forall m. Monoid m => ComputedFieldOrderByElement b m -> m
forall a. ComputedFieldOrderByElement b a -> Bool
forall a. ComputedFieldOrderByElement b a -> Int
forall a. ComputedFieldOrderByElement b a -> [a]
forall a. (a -> a -> a) -> ComputedFieldOrderByElement b a -> a
forall m a.
Monoid m =>
(a -> m) -> ComputedFieldOrderByElement b a -> m
forall b a.
(b -> a -> b) -> b -> ComputedFieldOrderByElement b a -> b
forall a b.
(a -> b -> b) -> b -> ComputedFieldOrderByElement b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> ComputedFieldOrderByElement b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
ComputedFieldOrderByElement b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
ComputedFieldOrderByElement b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
ComputedFieldOrderByElement b m -> m
forall (b :: BackendType) a.
Backend b =>
ComputedFieldOrderByElement b a -> Bool
forall (b :: BackendType) a.
Backend b =>
ComputedFieldOrderByElement b a -> Int
forall (b :: BackendType) a.
Backend b =>
ComputedFieldOrderByElement b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ComputedFieldOrderByElement b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ComputedFieldOrderByElement b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ComputedFieldOrderByElement b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ComputedFieldOrderByElement 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
product :: ComputedFieldOrderByElement b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
ComputedFieldOrderByElement b a -> a
sum :: ComputedFieldOrderByElement b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
ComputedFieldOrderByElement b a -> a
minimum :: ComputedFieldOrderByElement b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
ComputedFieldOrderByElement b a -> a
maximum :: ComputedFieldOrderByElement b a -> a
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
ComputedFieldOrderByElement b a -> a
elem :: a -> ComputedFieldOrderByElement b a -> Bool
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> ComputedFieldOrderByElement b a -> Bool
length :: ComputedFieldOrderByElement b a -> Int
$clength :: forall (b :: BackendType) a.
Backend b =>
ComputedFieldOrderByElement b a -> Int
null :: ComputedFieldOrderByElement b a -> Bool
$cnull :: forall (b :: BackendType) a.
Backend b =>
ComputedFieldOrderByElement b a -> Bool
toList :: ComputedFieldOrderByElement b a -> [a]
$ctoList :: forall (b :: BackendType) a.
Backend b =>
ComputedFieldOrderByElement b a -> [a]
foldl1 :: (a -> a -> a) -> ComputedFieldOrderByElement b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ComputedFieldOrderByElement b a -> a
foldr1 :: (a -> a -> a) -> ComputedFieldOrderByElement b a -> a
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> ComputedFieldOrderByElement b a -> a
foldl' :: (b -> a -> b) -> b -> ComputedFieldOrderByElement b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ComputedFieldOrderByElement b a -> b
foldl :: (b -> a -> b) -> b -> ComputedFieldOrderByElement b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> ComputedFieldOrderByElement b a -> b
foldr' :: (a -> b -> b) -> b -> ComputedFieldOrderByElement b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ComputedFieldOrderByElement b a -> b
foldr :: (a -> b -> b) -> b -> ComputedFieldOrderByElement b a -> b
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> ComputedFieldOrderByElement b a -> b
foldMap' :: (a -> m) -> ComputedFieldOrderByElement b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ComputedFieldOrderByElement b a -> m
foldMap :: (a -> m) -> ComputedFieldOrderByElement b a -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> ComputedFieldOrderByElement b a -> m
fold :: ComputedFieldOrderByElement b m -> m
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
ComputedFieldOrderByElement b m -> m
Foldable, Functor (ComputedFieldOrderByElement b)
Foldable (ComputedFieldOrderByElement b)
Functor (ComputedFieldOrderByElement b)
-> Foldable (ComputedFieldOrderByElement b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b)
    -> ComputedFieldOrderByElement b a
    -> f (ComputedFieldOrderByElement b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    ComputedFieldOrderByElement b (f a)
    -> f (ComputedFieldOrderByElement b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b)
    -> ComputedFieldOrderByElement b a
    -> m (ComputedFieldOrderByElement b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    ComputedFieldOrderByElement b (m a)
    -> m (ComputedFieldOrderByElement b a))
-> Traversable (ComputedFieldOrderByElement b)
(a -> f b)
-> ComputedFieldOrderByElement b a
-> f (ComputedFieldOrderByElement b b)
forall (b :: BackendType).
Backend b =>
Functor (ComputedFieldOrderByElement b)
forall (b :: BackendType).
Backend b =>
Foldable (ComputedFieldOrderByElement b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
ComputedFieldOrderByElement b (m a)
-> m (ComputedFieldOrderByElement b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
ComputedFieldOrderByElement b (f a)
-> f (ComputedFieldOrderByElement b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> ComputedFieldOrderByElement b a
-> m (ComputedFieldOrderByElement b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> ComputedFieldOrderByElement b a
-> f (ComputedFieldOrderByElement 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 =>
ComputedFieldOrderByElement b (m a)
-> m (ComputedFieldOrderByElement b a)
forall (f :: * -> *) a.
Applicative f =>
ComputedFieldOrderByElement b (f a)
-> f (ComputedFieldOrderByElement b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> ComputedFieldOrderByElement b a
-> m (ComputedFieldOrderByElement b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> ComputedFieldOrderByElement b a
-> f (ComputedFieldOrderByElement b b)
sequence :: ComputedFieldOrderByElement b (m a)
-> m (ComputedFieldOrderByElement b a)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
ComputedFieldOrderByElement b (m a)
-> m (ComputedFieldOrderByElement b a)
mapM :: (a -> m b)
-> ComputedFieldOrderByElement b a
-> m (ComputedFieldOrderByElement b b)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> ComputedFieldOrderByElement b a
-> m (ComputedFieldOrderByElement b b)
sequenceA :: ComputedFieldOrderByElement b (f a)
-> f (ComputedFieldOrderByElement b a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
ComputedFieldOrderByElement b (f a)
-> f (ComputedFieldOrderByElement b a)
traverse :: (a -> f b)
-> ComputedFieldOrderByElement b a
-> f (ComputedFieldOrderByElement b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> ComputedFieldOrderByElement b a
-> f (ComputedFieldOrderByElement b b)
$cp2Traversable :: forall (b :: BackendType).
Backend b =>
Foldable (ComputedFieldOrderByElement b)
$cp1Traversable :: forall (b :: BackendType).
Backend b =>
Functor (ComputedFieldOrderByElement b)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AnnBoolExp b v),
    Eq (AnnotatedAggregateOrderBy b)
  ) =>
  Eq (ComputedFieldOrderByElement b v)

deriving stock instance
  ( Backend b,
    Show v,
    Show (AnnBoolExp b v),
    Show (AnnotatedAggregateOrderBy b)
  ) =>
  Show (ComputedFieldOrderByElement b v)

instance
  ( Backend b,
    Hashable (AnnBoolExp b v),
    Hashable (AnnotatedAggregateOrderBy b)
  ) =>
  Hashable (ComputedFieldOrderByElement b v)

data ComputedFieldOrderBy (b :: BackendType) v = ComputedFieldOrderBy
  { ComputedFieldOrderBy b v -> XComputedField b
_cfobXField :: XComputedField b,
    ComputedFieldOrderBy b v -> ComputedFieldName
_cfobName :: ComputedFieldName,
    ComputedFieldOrderBy b v -> FunctionName b
_cfobFunction :: FunctionName b,
    ComputedFieldOrderBy b v -> FunctionArgsExp b v
_cfobFunctionArgsExp :: FunctionArgsExp b v,
    ComputedFieldOrderBy b v -> ComputedFieldOrderByElement b v
_cfobOrderByElement :: ComputedFieldOrderByElement b v
  }
  deriving stock ((forall x.
 ComputedFieldOrderBy b v -> Rep (ComputedFieldOrderBy b v) x)
-> (forall x.
    Rep (ComputedFieldOrderBy b v) x -> ComputedFieldOrderBy b v)
-> Generic (ComputedFieldOrderBy b v)
forall x.
Rep (ComputedFieldOrderBy b v) x -> ComputedFieldOrderBy b v
forall x.
ComputedFieldOrderBy b v -> Rep (ComputedFieldOrderBy 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 (ComputedFieldOrderBy b v) x -> ComputedFieldOrderBy b v
forall (b :: BackendType) v x.
ComputedFieldOrderBy b v -> Rep (ComputedFieldOrderBy b v) x
$cto :: forall (b :: BackendType) v x.
Rep (ComputedFieldOrderBy b v) x -> ComputedFieldOrderBy b v
$cfrom :: forall (b :: BackendType) v x.
ComputedFieldOrderBy b v -> Rep (ComputedFieldOrderBy b v) x
Generic)

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

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

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

deriving stock instance
  ( Backend b,
    Eq (ComputedFieldOrderByElement b v),
    Eq (FunctionArgsExp b v)
  ) =>
  Eq (ComputedFieldOrderBy b v)

deriving stock instance
  ( Backend b,
    Show (ComputedFieldOrderByElement b v),
    Show (FunctionArgsExp b v)
  ) =>
  Show (ComputedFieldOrderBy b v)

instance
  ( Backend b,
    Hashable (ComputedFieldOrderByElement b v),
    Hashable (FunctionArgsExp b v)
  ) =>
  Hashable (ComputedFieldOrderBy b v)

data AnnotatedOrderByElement (b :: BackendType) v
  = AOCColumn (ColumnInfo b)
  | AOCObjectRelation
      (RelInfo b)
      (AnnBoolExp b v)
      -- ^ Permission filter of the remote table to which the relationship is defined
      (AnnotatedOrderByElement b v)
  | AOCArrayAggregation
      (RelInfo b)
      (AnnBoolExp b v)
      -- ^ Permission filter of the remote table to which the relationship is defined
      (AnnotatedAggregateOrderBy b)
  | AOCComputedField (ComputedFieldOrderBy b v)
  deriving stock ((forall x.
 AnnotatedOrderByElement b v -> Rep (AnnotatedOrderByElement b v) x)
-> (forall x.
    Rep (AnnotatedOrderByElement b v) x -> AnnotatedOrderByElement b v)
-> Generic (AnnotatedOrderByElement b v)
forall x.
Rep (AnnotatedOrderByElement b v) x -> AnnotatedOrderByElement b v
forall x.
AnnotatedOrderByElement b v -> Rep (AnnotatedOrderByElement 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 (AnnotatedOrderByElement b v) x -> AnnotatedOrderByElement b v
forall (b :: BackendType) v x.
AnnotatedOrderByElement b v -> Rep (AnnotatedOrderByElement b v) x
$cto :: forall (b :: BackendType) v x.
Rep (AnnotatedOrderByElement b v) x -> AnnotatedOrderByElement b v
$cfrom :: forall (b :: BackendType) v x.
AnnotatedOrderByElement b v -> Rep (AnnotatedOrderByElement b v) x
Generic, a -> AnnotatedOrderByElement b b -> AnnotatedOrderByElement b a
(a -> b)
-> AnnotatedOrderByElement b a -> AnnotatedOrderByElement b b
(forall a b.
 (a -> b)
 -> AnnotatedOrderByElement b a -> AnnotatedOrderByElement b b)
-> (forall a b.
    a -> AnnotatedOrderByElement b b -> AnnotatedOrderByElement b a)
-> Functor (AnnotatedOrderByElement b)
forall a b.
a -> AnnotatedOrderByElement b b -> AnnotatedOrderByElement b a
forall a b.
(a -> b)
-> AnnotatedOrderByElement b a -> AnnotatedOrderByElement b b
forall (b :: BackendType) a b.
Backend b =>
a -> AnnotatedOrderByElement b b -> AnnotatedOrderByElement b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b)
-> AnnotatedOrderByElement b a -> AnnotatedOrderByElement b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> AnnotatedOrderByElement b b -> AnnotatedOrderByElement b a
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> AnnotatedOrderByElement b b -> AnnotatedOrderByElement b a
fmap :: (a -> b)
-> AnnotatedOrderByElement b a -> AnnotatedOrderByElement b b
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b)
-> AnnotatedOrderByElement b a -> AnnotatedOrderByElement b b
Functor, AnnotatedOrderByElement b a -> Bool
(a -> m) -> AnnotatedOrderByElement b a -> m
(a -> b -> b) -> b -> AnnotatedOrderByElement b a -> b
(forall m. Monoid m => AnnotatedOrderByElement b m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnotatedOrderByElement b a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnotatedOrderByElement b a -> m)
-> (forall a b.
    (a -> b -> b) -> b -> AnnotatedOrderByElement b a -> b)
-> (forall a b.
    (a -> b -> b) -> b -> AnnotatedOrderByElement b a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> AnnotatedOrderByElement b a -> b)
-> (forall b a.
    (b -> a -> b) -> b -> AnnotatedOrderByElement b a -> b)
-> (forall a. (a -> a -> a) -> AnnotatedOrderByElement b a -> a)
-> (forall a. (a -> a -> a) -> AnnotatedOrderByElement b a -> a)
-> (forall a. AnnotatedOrderByElement b a -> [a])
-> (forall a. AnnotatedOrderByElement b a -> Bool)
-> (forall a. AnnotatedOrderByElement b a -> Int)
-> (forall a. Eq a => a -> AnnotatedOrderByElement b a -> Bool)
-> (forall a. Ord a => AnnotatedOrderByElement b a -> a)
-> (forall a. Ord a => AnnotatedOrderByElement b a -> a)
-> (forall a. Num a => AnnotatedOrderByElement b a -> a)
-> (forall a. Num a => AnnotatedOrderByElement b a -> a)
-> Foldable (AnnotatedOrderByElement b)
forall a. Eq a => a -> AnnotatedOrderByElement b a -> Bool
forall a. Num a => AnnotatedOrderByElement b a -> a
forall a. Ord a => AnnotatedOrderByElement b a -> a
forall m. Monoid m => AnnotatedOrderByElement b m -> m
forall a. AnnotatedOrderByElement b a -> Bool
forall a. AnnotatedOrderByElement b a -> Int
forall a. AnnotatedOrderByElement b a -> [a]
forall a. (a -> a -> a) -> AnnotatedOrderByElement b a -> a
forall m a.
Monoid m =>
(a -> m) -> AnnotatedOrderByElement b a -> m
forall b a. (b -> a -> b) -> b -> AnnotatedOrderByElement b a -> b
forall a b. (a -> b -> b) -> b -> AnnotatedOrderByElement b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> AnnotatedOrderByElement b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
AnnotatedOrderByElement b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
AnnotatedOrderByElement b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
AnnotatedOrderByElement b m -> m
forall (b :: BackendType) a.
Backend b =>
AnnotatedOrderByElement b a -> Bool
forall (b :: BackendType) a.
Backend b =>
AnnotatedOrderByElement b a -> Int
forall (b :: BackendType) a.
Backend b =>
AnnotatedOrderByElement b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AnnotatedOrderByElement b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnotatedOrderByElement b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AnnotatedOrderByElement b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AnnotatedOrderByElement 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
product :: AnnotatedOrderByElement b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
AnnotatedOrderByElement b a -> a
sum :: AnnotatedOrderByElement b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
AnnotatedOrderByElement b a -> a
minimum :: AnnotatedOrderByElement b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
AnnotatedOrderByElement b a -> a
maximum :: AnnotatedOrderByElement b a -> a
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
AnnotatedOrderByElement b a -> a
elem :: a -> AnnotatedOrderByElement b a -> Bool
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> AnnotatedOrderByElement b a -> Bool
length :: AnnotatedOrderByElement b a -> Int
$clength :: forall (b :: BackendType) a.
Backend b =>
AnnotatedOrderByElement b a -> Int
null :: AnnotatedOrderByElement b a -> Bool
$cnull :: forall (b :: BackendType) a.
Backend b =>
AnnotatedOrderByElement b a -> Bool
toList :: AnnotatedOrderByElement b a -> [a]
$ctoList :: forall (b :: BackendType) a.
Backend b =>
AnnotatedOrderByElement b a -> [a]
foldl1 :: (a -> a -> a) -> AnnotatedOrderByElement b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AnnotatedOrderByElement b a -> a
foldr1 :: (a -> a -> a) -> AnnotatedOrderByElement b a -> a
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AnnotatedOrderByElement b a -> a
foldl' :: (b -> a -> b) -> b -> AnnotatedOrderByElement b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AnnotatedOrderByElement b a -> b
foldl :: (b -> a -> b) -> b -> AnnotatedOrderByElement b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AnnotatedOrderByElement b a -> b
foldr' :: (a -> b -> b) -> b -> AnnotatedOrderByElement b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AnnotatedOrderByElement b a -> b
foldr :: (a -> b -> b) -> b -> AnnotatedOrderByElement b a -> b
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AnnotatedOrderByElement b a -> b
foldMap' :: (a -> m) -> AnnotatedOrderByElement b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnotatedOrderByElement b a -> m
foldMap :: (a -> m) -> AnnotatedOrderByElement b a -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnotatedOrderByElement b a -> m
fold :: AnnotatedOrderByElement b m -> m
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
AnnotatedOrderByElement b m -> m
Foldable, Functor (AnnotatedOrderByElement b)
Foldable (AnnotatedOrderByElement b)
Functor (AnnotatedOrderByElement b)
-> Foldable (AnnotatedOrderByElement b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b)
    -> AnnotatedOrderByElement b a -> f (AnnotatedOrderByElement b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnotatedOrderByElement b (f a) -> f (AnnotatedOrderByElement b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b)
    -> AnnotatedOrderByElement b a -> m (AnnotatedOrderByElement b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnotatedOrderByElement b (m a) -> m (AnnotatedOrderByElement b a))
-> Traversable (AnnotatedOrderByElement b)
(a -> f b)
-> AnnotatedOrderByElement b a -> f (AnnotatedOrderByElement b b)
forall (b :: BackendType).
Backend b =>
Functor (AnnotatedOrderByElement b)
forall (b :: BackendType).
Backend b =>
Foldable (AnnotatedOrderByElement b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
AnnotatedOrderByElement b (m a) -> m (AnnotatedOrderByElement b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnotatedOrderByElement b (f a) -> f (AnnotatedOrderByElement b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> AnnotatedOrderByElement b a -> m (AnnotatedOrderByElement b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> AnnotatedOrderByElement b a -> f (AnnotatedOrderByElement 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 =>
AnnotatedOrderByElement b (m a) -> m (AnnotatedOrderByElement b a)
forall (f :: * -> *) a.
Applicative f =>
AnnotatedOrderByElement b (f a) -> f (AnnotatedOrderByElement b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> AnnotatedOrderByElement b a -> m (AnnotatedOrderByElement b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b)
-> AnnotatedOrderByElement b a -> f (AnnotatedOrderByElement b b)
sequence :: AnnotatedOrderByElement b (m a) -> m (AnnotatedOrderByElement b a)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
AnnotatedOrderByElement b (m a) -> m (AnnotatedOrderByElement b a)
mapM :: (a -> m b)
-> AnnotatedOrderByElement b a -> m (AnnotatedOrderByElement b b)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> AnnotatedOrderByElement b a -> m (AnnotatedOrderByElement b b)
sequenceA :: AnnotatedOrderByElement b (f a) -> f (AnnotatedOrderByElement b a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnotatedOrderByElement b (f a) -> f (AnnotatedOrderByElement b a)
traverse :: (a -> f b)
-> AnnotatedOrderByElement b a -> f (AnnotatedOrderByElement b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b)
-> AnnotatedOrderByElement b a -> f (AnnotatedOrderByElement b b)
$cp2Traversable :: forall (b :: BackendType).
Backend b =>
Foldable (AnnotatedOrderByElement b)
$cp1Traversable :: forall (b :: BackendType).
Backend b =>
Functor (AnnotatedOrderByElement b)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AnnBoolExp b v),
    Eq (AnnotatedAggregateOrderBy b),
    Eq (ComputedFieldOrderBy b v)
  ) =>
  Eq (AnnotatedOrderByElement b v)

deriving stock instance
  ( Backend b,
    Show (AnnBoolExp b v),
    Show (AnnotatedAggregateOrderBy b),
    Show (ComputedFieldOrderBy b v)
  ) =>
  Show (AnnotatedOrderByElement b v)

instance
  ( Backend b,
    Hashable (AnnBoolExp b v),
    Hashable (AnnotatedAggregateOrderBy b),
    Hashable (ComputedFieldOrderBy b v)
  ) =>
  Hashable (AnnotatedOrderByElement b v)

data AnnotatedAggregateOrderBy (b :: BackendType)
  = AAOCount
  | AAOOp Text (ColumnInfo b)
  deriving stock ((forall x.
 AnnotatedAggregateOrderBy b -> Rep (AnnotatedAggregateOrderBy b) x)
-> (forall x.
    Rep (AnnotatedAggregateOrderBy b) x -> AnnotatedAggregateOrderBy b)
-> Generic (AnnotatedAggregateOrderBy b)
forall x.
Rep (AnnotatedAggregateOrderBy b) x -> AnnotatedAggregateOrderBy b
forall x.
AnnotatedAggregateOrderBy b -> Rep (AnnotatedAggregateOrderBy b) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (b :: BackendType) x.
Rep (AnnotatedAggregateOrderBy b) x -> AnnotatedAggregateOrderBy b
forall (b :: BackendType) x.
AnnotatedAggregateOrderBy b -> Rep (AnnotatedAggregateOrderBy b) x
$cto :: forall (b :: BackendType) x.
Rep (AnnotatedAggregateOrderBy b) x -> AnnotatedAggregateOrderBy b
$cfrom :: forall (b :: BackendType) x.
AnnotatedAggregateOrderBy b -> Rep (AnnotatedAggregateOrderBy b) x
Generic)

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

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

instance (Backend b) => Hashable (AnnotatedAggregateOrderBy b)

type AnnotatedOrderByItemG b v = OrderByItemG b (AnnotatedOrderByElement b v)

type AnnotatedOrderByItem b = AnnotatedOrderByItemG b (SQLExpression b)

-- | Cursor for streaming subscription
data StreamCursorItem (b :: BackendType) = StreamCursorItem
  { -- | Specifies how the cursor item should be ordered
    StreamCursorItem b -> CursorOrdering
_sciOrdering :: CursorOrdering,
    -- | Column info of the cursor item
    StreamCursorItem b -> ColumnInfo b
_sciColInfo :: ColumnInfo b,
    -- | Initial value of the cursor item from where the streaming should start
    StreamCursorItem b -> ColumnValue b
_sciInitialValue :: ColumnValue b
  }
  deriving ((forall x. StreamCursorItem b -> Rep (StreamCursorItem b) x)
-> (forall x. Rep (StreamCursorItem b) x -> StreamCursorItem b)
-> Generic (StreamCursorItem b)
forall x. Rep (StreamCursorItem b) x -> StreamCursorItem b
forall x. StreamCursorItem b -> Rep (StreamCursorItem b) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (b :: BackendType) x.
Rep (StreamCursorItem b) x -> StreamCursorItem b
forall (b :: BackendType) x.
StreamCursorItem b -> Rep (StreamCursorItem b) x
$cto :: forall (b :: BackendType) x.
Rep (StreamCursorItem b) x -> StreamCursorItem b
$cfrom :: forall (b :: BackendType) x.
StreamCursorItem b -> Rep (StreamCursorItem b) x
Generic)

deriving instance (Backend b) => Eq (StreamCursorItem b)

deriving instance (Backend b) => Show (StreamCursorItem b)

-- 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
    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.
    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
/= :: 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
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
showList :: [RemoteRelationshipSelect b r] -> ShowS
$cshowList :: forall (b :: BackendType) r.
(Backend b, Show r) =>
[RemoteRelationshipSelect b r] -> ShowS
show :: RemoteRelationshipSelect b r -> String
$cshow :: forall (b :: BackendType) r.
(Backend b, Show r) =>
RemoteRelationshipSelect b r -> String
showsPrec :: Int -> RemoteRelationshipSelect b r -> ShowS
$cshowsPrec :: forall (b :: BackendType) r.
(Backend b, Show r) =>
Int -> RemoteRelationshipSelect b r -> ShowS
Show, a -> RemoteRelationshipSelect b b -> RemoteRelationshipSelect b a
(a -> b)
-> RemoteRelationshipSelect b a -> RemoteRelationshipSelect b b
(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
<$ :: a -> RemoteRelationshipSelect b b -> RemoteRelationshipSelect b a
$c<$ :: forall (b :: BackendType) a b.
a -> RemoteRelationshipSelect b b -> RemoteRelationshipSelect b a
fmap :: (a -> b)
-> RemoteRelationshipSelect b a -> RemoteRelationshipSelect b b
$cfmap :: forall (b :: BackendType) a b.
(a -> b)
-> RemoteRelationshipSelect b a -> RemoteRelationshipSelect b b
Functor, RemoteRelationshipSelect b a -> Bool
(a -> m) -> RemoteRelationshipSelect b a -> m
(a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
(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
product :: RemoteRelationshipSelect b a -> a
$cproduct :: forall (b :: BackendType) a.
Num a =>
RemoteRelationshipSelect b a -> a
sum :: RemoteRelationshipSelect b a -> a
$csum :: forall (b :: BackendType) a.
Num a =>
RemoteRelationshipSelect b a -> a
minimum :: RemoteRelationshipSelect b a -> a
$cminimum :: forall (b :: BackendType) a.
Ord a =>
RemoteRelationshipSelect b a -> a
maximum :: RemoteRelationshipSelect b a -> a
$cmaximum :: forall (b :: BackendType) a.
Ord a =>
RemoteRelationshipSelect b a -> a
elem :: a -> RemoteRelationshipSelect b a -> Bool
$celem :: forall (b :: BackendType) a.
Eq a =>
a -> RemoteRelationshipSelect b a -> Bool
length :: RemoteRelationshipSelect b a -> Int
$clength :: forall (b :: BackendType) a. RemoteRelationshipSelect b a -> Int
null :: RemoteRelationshipSelect b a -> Bool
$cnull :: forall (b :: BackendType) a. RemoteRelationshipSelect b a -> Bool
toList :: RemoteRelationshipSelect b a -> [a]
$ctoList :: forall (b :: BackendType) a. RemoteRelationshipSelect b a -> [a]
foldl1 :: (a -> a -> a) -> RemoteRelationshipSelect b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
(a -> a -> a) -> RemoteRelationshipSelect b a -> a
foldr1 :: (a -> a -> a) -> RemoteRelationshipSelect b a -> a
$cfoldr1 :: forall (b :: BackendType) a.
(a -> a -> a) -> RemoteRelationshipSelect b a -> a
foldl' :: (b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
(b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
foldl :: (b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
$cfoldl :: forall (b :: BackendType) b a.
(b -> a -> b) -> b -> RemoteRelationshipSelect b a -> b
foldr' :: (a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
(a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
foldr :: (a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
$cfoldr :: forall (b :: BackendType) a b.
(a -> b -> b) -> b -> RemoteRelationshipSelect b a -> b
foldMap' :: (a -> m) -> RemoteRelationshipSelect b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
Monoid m =>
(a -> m) -> RemoteRelationshipSelect b a -> m
foldMap :: (a -> m) -> RemoteRelationshipSelect b a -> m
$cfoldMap :: forall (b :: BackendType) m a.
Monoid m =>
(a -> m) -> RemoteRelationshipSelect b a -> m
fold :: RemoteRelationshipSelect b m -> m
$cfold :: forall (b :: BackendType) m.
Monoid m =>
RemoteRelationshipSelect b m -> m
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)
(a -> f b)
-> RemoteRelationshipSelect b a -> f (RemoteRelationshipSelect b 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)
sequence :: RemoteRelationshipSelect b (m a)
-> m (RemoteRelationshipSelect b a)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
Monad m =>
RemoteRelationshipSelect b (m a)
-> m (RemoteRelationshipSelect b a)
mapM :: (a -> m b)
-> RemoteRelationshipSelect b a -> m (RemoteRelationshipSelect b b)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
Monad m =>
(a -> m b)
-> RemoteRelationshipSelect b a -> m (RemoteRelationshipSelect b b)
sequenceA :: RemoteRelationshipSelect b (f a)
-> f (RemoteRelationshipSelect b a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
Applicative f =>
RemoteRelationshipSelect b (f a)
-> f (RemoteRelationshipSelect b a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType). Foldable (RemoteRelationshipSelect b)
$cp1Traversable :: forall (b :: BackendType). Functor (RemoteRelationshipSelect b)
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
  deriving stock (a -> AnnFieldG b r b -> AnnFieldG b r a
(a -> b) -> AnnFieldG b r a -> AnnFieldG b r b
(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
<$ :: a -> AnnFieldG b r b -> AnnFieldG b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> AnnFieldG b r b -> AnnFieldG b r a
fmap :: (a -> b) -> AnnFieldG b r a -> AnnFieldG b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> AnnFieldG b r a -> AnnFieldG b r b
Functor, AnnFieldG b r a -> Bool
(a -> m) -> AnnFieldG b r a -> m
(a -> b -> b) -> b -> AnnFieldG b r a -> b
(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
product :: AnnFieldG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnFieldG b r a -> a
sum :: AnnFieldG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnFieldG b r a -> a
minimum :: AnnFieldG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnFieldG b r a -> a
maximum :: AnnFieldG b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnFieldG b r a -> a
elem :: a -> AnnFieldG b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnFieldG b r a -> Bool
length :: AnnFieldG b r a -> Int
$clength :: forall (b :: BackendType) r a. Backend b => AnnFieldG b r a -> Int
null :: AnnFieldG b r a -> Bool
$cnull :: forall (b :: BackendType) r a. Backend b => AnnFieldG b r a -> Bool
toList :: AnnFieldG b r a -> [a]
$ctoList :: forall (b :: BackendType) r a. Backend b => AnnFieldG b r a -> [a]
foldl1 :: (a -> a -> a) -> AnnFieldG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnFieldG b r a -> a
foldr1 :: (a -> a -> a) -> AnnFieldG b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnFieldG b r a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: AnnFieldG b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnFieldG b r m -> m
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)
(a -> f b) -> AnnFieldG b r a -> f (AnnFieldG b r b)
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)
sequence :: AnnFieldG b r (m a) -> m (AnnFieldG b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnFieldG b r (m a) -> m (AnnFieldG b r a)
mapM :: (a -> m b) -> AnnFieldG b r a -> m (AnnFieldG b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnFieldG b r a -> m (AnnFieldG b r b)
sequenceA :: AnnFieldG b r (f a) -> f (AnnFieldG b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnFieldG b r (f a) -> f (AnnFieldG b r a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType) r. Backend b => Foldable (AnnFieldG b r)
$cp1Traversable :: forall (b :: BackendType) r. Backend b => Functor (AnnFieldG b r)
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 (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 (AnnFieldG b r v)

instance Backend b => Bifoldable (AnnFieldG b) where
  bifoldMap :: (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 (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 (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((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 (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 (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 (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

type AnnField b = AnnFieldG b Void (SQLExpression b)

type AnnFields b = AnnFieldsG b Void (SQLExpression b)

mkAnnColumnField ::
  Column backend ->
  ColumnType backend ->
  Maybe (AnnColumnCaseBoolExp backend v) ->
  Maybe (ScalarSelectionArguments backend) ->
  AnnFieldG backend r v
mkAnnColumnField :: Column backend
-> ColumnType backend
-> Maybe (AnnColumnCaseBoolExp backend v)
-> Maybe (ScalarSelectionArguments backend)
-> AnnFieldG backend r v
mkAnnColumnField Column backend
col ColumnType backend
typ Maybe (AnnColumnCaseBoolExp backend v)
caseBoolExp 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)
-> Maybe (AnnColumnCaseBoolExp backend v)
-> AnnColumnField backend v
forall (b :: BackendType) v.
Column b
-> ColumnType b
-> Bool
-> Maybe (ScalarSelectionArguments b)
-> Maybe (AnnColumnCaseBoolExp b v)
-> AnnColumnField b v
AnnColumnField Column backend
col ColumnType backend
typ Bool
False Maybe (ScalarSelectionArguments backend)
colOpM Maybe (AnnColumnCaseBoolExp backend v)
caseBoolExp)

mkAnnColumnFieldAsText ::
  ColumnInfo backend ->
  AnnFieldG backend r v
mkAnnColumnFieldAsText :: 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)
-> Maybe (AnnColumnCaseBoolExp backend v)
-> AnnColumnField backend v
forall (b :: BackendType) v.
Column b
-> ColumnType b
-> Bool
-> Maybe (ScalarSelectionArguments b)
-> Maybe (AnnColumnCaseBoolExp 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 Maybe (AnnColumnCaseBoolExp backend v)
forall a. Maybe a
Nothing)

traverseSourceRelationshipSelection ::
  (Applicative f, Backend backend) =>
  (vf backend -> f (vg backend)) ->
  SourceRelationshipSelection backend r vf ->
  f (SourceRelationshipSelection backend r vg)
traverseSourceRelationshipSelection :: (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)
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)
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)
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)
  | TAFNodes (XNodesAgg b) (AnnFieldsG b r v)
  | TAFExp Text
  deriving stock (a -> TableAggregateFieldG b r b -> TableAggregateFieldG b r a
(a -> b)
-> TableAggregateFieldG b r a -> TableAggregateFieldG b r b
(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
<$ :: a -> TableAggregateFieldG b r b -> TableAggregateFieldG b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> TableAggregateFieldG b r b -> TableAggregateFieldG b r a
fmap :: (a -> b)
-> TableAggregateFieldG b r a -> TableAggregateFieldG b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b)
-> TableAggregateFieldG b r a -> TableAggregateFieldG b r b
Functor, TableAggregateFieldG b r a -> Bool
(a -> m) -> TableAggregateFieldG b r a -> m
(a -> b -> b) -> b -> TableAggregateFieldG b r a -> b
(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
product :: TableAggregateFieldG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
TableAggregateFieldG b r a -> a
sum :: TableAggregateFieldG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
TableAggregateFieldG b r a -> a
minimum :: TableAggregateFieldG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
TableAggregateFieldG b r a -> a
maximum :: TableAggregateFieldG b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
TableAggregateFieldG b r a -> a
elem :: a -> TableAggregateFieldG b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> TableAggregateFieldG b r a -> Bool
length :: TableAggregateFieldG b r a -> Int
$clength :: forall (b :: BackendType) r a.
Backend b =>
TableAggregateFieldG b r a -> Int
null :: TableAggregateFieldG b r a -> Bool
$cnull :: forall (b :: BackendType) r a.
Backend b =>
TableAggregateFieldG b r a -> Bool
toList :: TableAggregateFieldG b r a -> [a]
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
TableAggregateFieldG b r a -> [a]
foldl1 :: (a -> a -> a) -> TableAggregateFieldG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> TableAggregateFieldG b r a -> a
foldr1 :: (a -> a -> a) -> TableAggregateFieldG b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> TableAggregateFieldG b r a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: TableAggregateFieldG b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
TableAggregateFieldG b r m -> m
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)
(a -> f b)
-> TableAggregateFieldG b r a -> f (TableAggregateFieldG b r b)
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)
sequence :: TableAggregateFieldG b r (m a) -> m (TableAggregateFieldG b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
TableAggregateFieldG b r (m a) -> m (TableAggregateFieldG b r a)
mapM :: (a -> m b)
-> TableAggregateFieldG b r a -> m (TableAggregateFieldG b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> TableAggregateFieldG b r a -> m (TableAggregateFieldG b r b)
sequenceA :: TableAggregateFieldG b r (f a) -> f (TableAggregateFieldG b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
TableAggregateFieldG b r (f a) -> f (TableAggregateFieldG b r a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType) r.
Backend b =>
Foldable (TableAggregateFieldG b r)
$cp1Traversable :: forall (b :: BackendType) r.
Backend b =>
Functor (TableAggregateFieldG b r)
Traversable)

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

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

instance Backend b => Bifoldable (TableAggregateFieldG b) where
  bifoldMap :: (a -> m) -> (b -> m) -> TableAggregateFieldG b a b -> m
bifoldMap a -> m
f b -> m
g = \case
    TAFAgg {} -> m
forall a. Monoid a => a
mempty
    TAFNodes XNodesAgg b
_ AnnFieldsG b a b
fields -> ((FieldName, AnnFieldG b a b) -> m) -> AnnFieldsG b a b -> 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 (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 (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
fields
    TAFExp {} -> m
forall a. Monoid a => a
mempty

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

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

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

data AggregateOp (b :: BackendType) = AggregateOp
  { AggregateOp b -> Text
_aoOp :: Text,
    AggregateOp b -> ColumnFields b
_aoFields :: (ColumnFields b)
  }
  deriving stock (AggregateOp b -> AggregateOp b -> Bool
(AggregateOp b -> AggregateOp b -> Bool)
-> (AggregateOp b -> AggregateOp b -> Bool) -> Eq (AggregateOp b)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (b :: BackendType).
Backend b =>
AggregateOp b -> AggregateOp b -> Bool
/= :: AggregateOp b -> AggregateOp b -> Bool
$c/= :: forall (b :: BackendType).
Backend b =>
AggregateOp b -> AggregateOp b -> Bool
== :: AggregateOp b -> AggregateOp b -> Bool
$c== :: forall (b :: BackendType).
Backend b =>
AggregateOp b -> AggregateOp b -> Bool
Eq, Int -> AggregateOp b -> ShowS
[AggregateOp b] -> ShowS
AggregateOp b -> String
(Int -> AggregateOp b -> ShowS)
-> (AggregateOp b -> String)
-> ([AggregateOp b] -> ShowS)
-> Show (AggregateOp b)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (b :: BackendType).
Backend b =>
Int -> AggregateOp b -> ShowS
forall (b :: BackendType). Backend b => [AggregateOp b] -> ShowS
forall (b :: BackendType). Backend b => AggregateOp b -> String
showList :: [AggregateOp b] -> ShowS
$cshowList :: forall (b :: BackendType). Backend b => [AggregateOp b] -> ShowS
show :: AggregateOp b -> String
$cshow :: forall (b :: BackendType). Backend b => AggregateOp b -> String
showsPrec :: Int -> AggregateOp b -> ShowS
$cshowsPrec :: forall (b :: BackendType).
Backend b =>
Int -> AggregateOp b -> ShowS
Show)

data ColFld (b :: BackendType)
  = CFCol (Column b) (ColumnType b)
  | CFExp Text
  deriving stock (ColFld b -> ColFld b -> Bool
(ColFld b -> ColFld b -> Bool)
-> (ColFld b -> ColFld b -> Bool) -> Eq (ColFld b)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (b :: BackendType).
Backend b =>
ColFld b -> ColFld b -> Bool
/= :: ColFld b -> ColFld b -> Bool
$c/= :: forall (b :: BackendType).
Backend b =>
ColFld b -> ColFld b -> Bool
== :: ColFld b -> ColFld b -> Bool
$c== :: forall (b :: BackendType).
Backend b =>
ColFld b -> ColFld b -> Bool
Eq, Int -> ColFld b -> ShowS
[ColFld b] -> ShowS
ColFld b -> String
(Int -> ColFld b -> ShowS)
-> (ColFld b -> String) -> ([ColFld b] -> ShowS) -> Show (ColFld b)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (b :: BackendType). Backend b => Int -> ColFld b -> ShowS
forall (b :: BackendType). Backend b => [ColFld b] -> ShowS
forall (b :: BackendType). Backend b => ColFld b -> String
showList :: [ColFld b] -> ShowS
$cshowList :: forall (b :: BackendType). Backend b => [ColFld b] -> ShowS
show :: ColFld b -> String
$cshow :: forall (b :: BackendType). Backend b => ColFld b -> String
showsPrec :: Int -> ColFld b -> ShowS
$cshowsPrec :: forall (b :: BackendType). Backend b => Int -> ColFld b -> ShowS
Show)

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 ColumnFields b = Fields (ColFld b)

type AggregateFields b = Fields (AggregateField b)

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 (a -> ConnectionField b r b -> ConnectionField b r a
(a -> b) -> ConnectionField b r a -> ConnectionField b r b
(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
<$ :: a -> ConnectionField b r b -> ConnectionField b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> ConnectionField b r b -> ConnectionField b r a
fmap :: (a -> b) -> ConnectionField b r a -> ConnectionField b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ConnectionField b r a -> ConnectionField b r b
Functor, ConnectionField b r a -> Bool
(a -> m) -> ConnectionField b r a -> m
(a -> b -> b) -> b -> ConnectionField b r a -> b
(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
product :: ConnectionField b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionField b r a -> a
sum :: ConnectionField b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ConnectionField b r a -> a
minimum :: ConnectionField b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionField b r a -> a
maximum :: ConnectionField b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ConnectionField b r a -> a
elem :: a -> ConnectionField b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ConnectionField b r a -> Bool
length :: ConnectionField b r a -> Int
$clength :: forall (b :: BackendType) r a.
Backend b =>
ConnectionField b r a -> Int
null :: ConnectionField b r a -> Bool
$cnull :: forall (b :: BackendType) r a.
Backend b =>
ConnectionField b r a -> Bool
toList :: ConnectionField b r a -> [a]
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
ConnectionField b r a -> [a]
foldl1 :: (a -> a -> a) -> ConnectionField b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionField b r a -> a
foldr1 :: (a -> a -> a) -> ConnectionField b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ConnectionField b r a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: ConnectionField b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ConnectionField b r m -> m
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)
(a -> f b) -> ConnectionField b r a -> f (ConnectionField b r b)
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)
sequence :: ConnectionField b r (m a) -> m (ConnectionField b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ConnectionField b r (m a) -> m (ConnectionField b r a)
mapM :: (a -> m b) -> ConnectionField b r a -> m (ConnectionField b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ConnectionField b r a -> m (ConnectionField b r b)
sequenceA :: ConnectionField b r (f a) -> f (ConnectionField b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ConnectionField b r (f a) -> f (ConnectionField b r a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType) r.
Backend b =>
Foldable (ConnectionField b r)
$cp1Traversable :: forall (b :: BackendType) r.
Backend b =>
Functor (ConnectionField b r)
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 :: (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 (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 (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 (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
showList :: [PageInfoField] -> ShowS
$cshowList :: [PageInfoField] -> ShowS
show :: PageInfoField -> String
$cshow :: PageInfoField -> String
showsPrec :: Int -> PageInfoField -> ShowS
$cshowsPrec :: Int -> PageInfoField -> ShowS
Show, PageInfoField -> PageInfoField -> Bool
(PageInfoField -> PageInfoField -> Bool)
-> (PageInfoField -> PageInfoField -> Bool) -> Eq PageInfoField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PageInfoField -> PageInfoField -> Bool
$c/= :: PageInfoField -> PageInfoField -> Bool
== :: PageInfoField -> PageInfoField -> Bool
$c== :: PageInfoField -> PageInfoField -> Bool
Eq)

data EdgeField (b :: BackendType) (r :: Type) v
  = EdgeTypename Text
  | EdgeCursor
  | EdgeNode (AnnFieldsG b r v)
  deriving stock (a -> EdgeField b r b -> EdgeField b r a
(a -> b) -> EdgeField b r a -> EdgeField b r b
(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
<$ :: a -> EdgeField b r b -> EdgeField b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> EdgeField b r b -> EdgeField b r a
fmap :: (a -> b) -> EdgeField b r a -> EdgeField b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> EdgeField b r a -> EdgeField b r b
Functor, EdgeField b r a -> Bool
(a -> m) -> EdgeField b r a -> m
(a -> b -> b) -> b -> EdgeField b r a -> b
(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
product :: EdgeField b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
EdgeField b r a -> a
sum :: EdgeField b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
EdgeField b r a -> a
minimum :: EdgeField b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
EdgeField b r a -> a
maximum :: EdgeField b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
EdgeField b r a -> a
elem :: a -> EdgeField b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> EdgeField b r a -> Bool
length :: EdgeField b r a -> Int
$clength :: forall (b :: BackendType) r a. Backend b => EdgeField b r a -> Int
null :: EdgeField b r a -> Bool
$cnull :: forall (b :: BackendType) r a. Backend b => EdgeField b r a -> Bool
toList :: EdgeField b r a -> [a]
$ctoList :: forall (b :: BackendType) r a. Backend b => EdgeField b r a -> [a]
foldl1 :: (a -> a -> a) -> EdgeField b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> EdgeField b r a -> a
foldr1 :: (a -> a -> a) -> EdgeField b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> EdgeField b r a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: EdgeField b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
EdgeField b r m -> m
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)
(a -> f b) -> EdgeField b r a -> f (EdgeField b r b)
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)
sequence :: EdgeField b r (m a) -> m (EdgeField b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
EdgeField b r (m a) -> m (EdgeField b r a)
mapM :: (a -> m b) -> EdgeField b r a -> m (EdgeField b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> EdgeField b r a -> m (EdgeField b r b)
sequenceA :: EdgeField b r (f a) -> f (EdgeField b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
EdgeField b r (f a) -> f (EdgeField b r a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType) r. Backend b => Foldable (EdgeField b r)
$cp1Traversable :: forall (b :: BackendType) r. Backend b => Functor (EdgeField b r)
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 :: (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 (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 (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 (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
  { AnnColumnField b v -> Column b
_acfColumn :: Column b,
    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.
    AnnColumnField b v -> Bool
_acfAsText :: Bool,
    -- | Arguments of this column's selection. See 'ScalarSelectionArguments'
    AnnColumnField b v -> Maybe (ScalarSelectionArguments b)
_acfArguments :: Maybe (ScalarSelectionArguments b),
    -- | This type is used to determine whether the column
    -- should be nullified. When the value is `Nothing`, the column value
    -- will be outputted as computed and when the value is `Just c`, the
    -- column will be outputted when `c` evaluates to `true` and `null`
    -- when `c` evaluates to `false`.
    AnnColumnField b v -> Maybe (AnnColumnCaseBoolExp b v)
_acfCaseBoolExpression :: (Maybe (AnnColumnCaseBoolExp b v))
  }
  deriving stock (a -> AnnColumnField b b -> AnnColumnField b a
(a -> b) -> AnnColumnField b a -> AnnColumnField b b
(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
<$ :: a -> AnnColumnField b b -> AnnColumnField b a
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> AnnColumnField b b -> AnnColumnField b a
fmap :: (a -> b) -> AnnColumnField b a -> AnnColumnField b b
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> AnnColumnField b a -> AnnColumnField b b
Functor, AnnColumnField b a -> Bool
(a -> m) -> AnnColumnField b a -> m
(a -> b -> b) -> b -> AnnColumnField b a -> b
(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
product :: AnnColumnField b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
AnnColumnField b a -> a
sum :: AnnColumnField b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
AnnColumnField b a -> a
minimum :: AnnColumnField b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
AnnColumnField b a -> a
maximum :: AnnColumnField b a -> a
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
AnnColumnField b a -> a
elem :: a -> AnnColumnField b a -> Bool
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> AnnColumnField b a -> Bool
length :: AnnColumnField b a -> Int
$clength :: forall (b :: BackendType) a. Backend b => AnnColumnField b a -> Int
null :: AnnColumnField b a -> Bool
$cnull :: forall (b :: BackendType) a.
Backend b =>
AnnColumnField b a -> Bool
toList :: AnnColumnField b a -> [a]
$ctoList :: forall (b :: BackendType) a. Backend b => AnnColumnField b a -> [a]
foldl1 :: (a -> a -> a) -> AnnColumnField b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AnnColumnField b a -> a
foldr1 :: (a -> a -> a) -> AnnColumnField b a -> a
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> AnnColumnField b a -> a
foldl' :: (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 :: (b -> a -> b) -> b -> AnnColumnField b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> AnnColumnField b a -> b
foldr' :: (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 :: (a -> b -> b) -> b -> AnnColumnField b a -> b
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> AnnColumnField b a -> b
foldMap' :: (a -> m) -> AnnColumnField b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnColumnField b a -> m
foldMap :: (a -> m) -> AnnColumnField b a -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnColumnField b a -> m
fold :: AnnColumnField b m -> m
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
AnnColumnField b m -> m
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)
(a -> f b) -> AnnColumnField b a -> f (AnnColumnField b 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)
sequence :: AnnColumnField b (m a) -> m (AnnColumnField b a)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
AnnColumnField b (m a) -> m (AnnColumnField b a)
mapM :: (a -> m b) -> AnnColumnField b a -> m (AnnColumnField b b)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnColumnField b a -> m (AnnColumnField b b)
sequenceA :: AnnColumnField b (f a) -> f (AnnColumnField b a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnColumnField b (f a) -> f (AnnColumnField b a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType). Backend b => Foldable (AnnColumnField b)
$cp1Traversable :: forall (b :: BackendType). Backend b => Functor (AnnColumnField b)
Traversable)

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

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

-- Computed field

data ComputedFieldScalarSelect (b :: BackendType) v = ComputedFieldScalarSelect
  { ComputedFieldScalarSelect b v -> FunctionName b
_cfssFunction :: FunctionName b,
    ComputedFieldScalarSelect b v -> FunctionArgsExp b v
_cfssArguments :: FunctionArgsExp b v,
    ComputedFieldScalarSelect b v -> ScalarType b
_cfssType :: ScalarType b,
    ComputedFieldScalarSelect b v -> Maybe (ScalarSelectionArguments b)
_cfssScalarArguments :: (Maybe (ScalarSelectionArguments b))
  }

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

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

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

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

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

data ComputedFieldSelect (b :: BackendType) (r :: Type) v
  = CFSScalar
      (ComputedFieldScalarSelect b v)
      -- ^ Type containing info about the computed field
      (Maybe (AnnColumnCaseBoolExp b v))
      -- ^ This type is used to determine if whether the scalar
      -- computed field should be nullified. When the value is `Nothing`,
      -- the scalar computed value will be outputted as computed and when the
      -- value is `Just c`, the scalar computed field will be outputted when
      -- `c` evaluates to `true` and `null` when `c` evaluates to `false`
  | CFSTable JsonAggSelect (AnnSimpleSelectG b r v)
  deriving stock (a -> ComputedFieldSelect b r b -> ComputedFieldSelect b r a
(a -> b) -> ComputedFieldSelect b r a -> ComputedFieldSelect b r b
(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
<$ :: a -> ComputedFieldSelect b r b -> ComputedFieldSelect b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> ComputedFieldSelect b r b -> ComputedFieldSelect b r a
fmap :: (a -> b) -> ComputedFieldSelect b r a -> ComputedFieldSelect b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ComputedFieldSelect b r a -> ComputedFieldSelect b r b
Functor, ComputedFieldSelect b r a -> Bool
(a -> m) -> ComputedFieldSelect b r a -> m
(a -> b -> b) -> b -> ComputedFieldSelect b r a -> b
(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
product :: ComputedFieldSelect b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ComputedFieldSelect b r a -> a
sum :: ComputedFieldSelect b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ComputedFieldSelect b r a -> a
minimum :: ComputedFieldSelect b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ComputedFieldSelect b r a -> a
maximum :: ComputedFieldSelect b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ComputedFieldSelect b r a -> a
elem :: a -> ComputedFieldSelect b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ComputedFieldSelect b r a -> Bool
length :: ComputedFieldSelect b r a -> Int
$clength :: forall (b :: BackendType) r a.
Backend b =>
ComputedFieldSelect b r a -> Int
null :: ComputedFieldSelect b r a -> Bool
$cnull :: forall (b :: BackendType) r a.
Backend b =>
ComputedFieldSelect b r a -> Bool
toList :: ComputedFieldSelect b r a -> [a]
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
ComputedFieldSelect b r a -> [a]
foldl1 :: (a -> a -> a) -> ComputedFieldSelect b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ComputedFieldSelect b r a -> a
foldr1 :: (a -> a -> a) -> ComputedFieldSelect b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ComputedFieldSelect b r a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: ComputedFieldSelect b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ComputedFieldSelect b r m -> m
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)
(a -> f b)
-> ComputedFieldSelect b r a -> f (ComputedFieldSelect b r b)
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)
sequence :: ComputedFieldSelect b r (m a) -> m (ComputedFieldSelect b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ComputedFieldSelect b r (m a) -> m (ComputedFieldSelect b r a)
mapM :: (a -> m b)
-> ComputedFieldSelect b r a -> m (ComputedFieldSelect b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b)
-> ComputedFieldSelect b r a -> m (ComputedFieldSelect b r b)
sequenceA :: ComputedFieldSelect b r (f a) -> f (ComputedFieldSelect b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ComputedFieldSelect b r (f a) -> f (ComputedFieldSelect b r a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType) r.
Backend b =>
Foldable (ComputedFieldSelect b r)
$cp1Traversable :: forall (b :: BackendType) r.
Backend b =>
Functor (ComputedFieldSelect b r)
Traversable)

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

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

instance Backend b => Bifoldable (ComputedFieldSelect b) where
  bifoldMap :: (a -> m) -> (b -> m) -> ComputedFieldSelect b a b -> m
bifoldMap a -> m
f b -> m
g = \case
    CFSScalar ComputedFieldScalarSelect b b
cfsSelect Maybe (AnnColumnCaseBoolExp b b)
caseBoolExp -> (b -> m) -> ComputedFieldScalarSelect b b -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap b -> m
g ComputedFieldScalarSelect b b
cfsSelect m -> m -> m
forall a. Semigroup a => a -> a -> a
<> (AnnColumnCaseBoolExp b b -> m)
-> Maybe (AnnColumnCaseBoolExp b b) -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnColumnCaseBoolExpField b b -> m)
-> AnnColumnCaseBoolExp b b -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((AnnColumnCaseBoolExpField b b -> m)
 -> AnnColumnCaseBoolExp b b -> m)
-> (AnnColumnCaseBoolExpField b b -> m)
-> AnnColumnCaseBoolExp b b
-> m
forall a b. (a -> b) -> a -> b
$ (b -> m) -> AnnColumnCaseBoolExpField b b -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap b -> m
g) Maybe (AnnColumnCaseBoolExp b b)
caseBoolExp
    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

data AnnRelationSelectG (b :: BackendType) a = AnnRelationSelectG
  { AnnRelationSelectG b a -> RelName
_aarRelationshipName :: RelName, -- Relationship name
    AnnRelationSelectG b a -> HashMap (Column b) (Column b)
_aarColumnMapping :: HashMap (Column b) (Column b), -- Column of left table to join with
    AnnRelationSelectG b a -> a
_aarAnnSelect :: a -- Current table. Almost ~ to SQL Select
  }
  deriving stock (a -> AnnRelationSelectG b b -> AnnRelationSelectG b a
(a -> b) -> AnnRelationSelectG b a -> AnnRelationSelectG b b
(forall a b.
 (a -> b) -> AnnRelationSelectG b a -> AnnRelationSelectG b b)
-> (forall a b.
    a -> AnnRelationSelectG b b -> AnnRelationSelectG b a)
-> Functor (AnnRelationSelectG b)
forall a b. a -> AnnRelationSelectG b b -> AnnRelationSelectG b a
forall a b.
(a -> b) -> AnnRelationSelectG b a -> AnnRelationSelectG b b
forall (b :: BackendType) a b.
a -> AnnRelationSelectG b b -> AnnRelationSelectG b a
forall (b :: BackendType) a b.
(a -> b) -> AnnRelationSelectG b a -> AnnRelationSelectG b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> AnnRelationSelectG b b -> AnnRelationSelectG b a
$c<$ :: forall (b :: BackendType) a b.
a -> AnnRelationSelectG b b -> AnnRelationSelectG b a
fmap :: (a -> b) -> AnnRelationSelectG b a -> AnnRelationSelectG b b
$cfmap :: forall (b :: BackendType) a b.
(a -> b) -> AnnRelationSelectG b a -> AnnRelationSelectG b b
Functor, AnnRelationSelectG b a -> Bool
(a -> m) -> AnnRelationSelectG b a -> m
(a -> b -> b) -> b -> AnnRelationSelectG b a -> b
(forall m. Monoid m => AnnRelationSelectG b m -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnRelationSelectG b a -> m)
-> (forall m a.
    Monoid m =>
    (a -> m) -> AnnRelationSelectG b a -> m)
-> (forall a b. (a -> b -> b) -> b -> AnnRelationSelectG b a -> b)
-> (forall a b. (a -> b -> b) -> b -> AnnRelationSelectG b a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnRelationSelectG b a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnRelationSelectG b a -> b)
-> (forall a. (a -> a -> a) -> AnnRelationSelectG b a -> a)
-> (forall a. (a -> a -> a) -> AnnRelationSelectG b a -> a)
-> (forall a. AnnRelationSelectG b a -> [a])
-> (forall a. AnnRelationSelectG b a -> Bool)
-> (forall a. AnnRelationSelectG b a -> Int)
-> (forall a. Eq a => a -> AnnRelationSelectG b a -> Bool)
-> (forall a. Ord a => AnnRelationSelectG b a -> a)
-> (forall a. Ord a => AnnRelationSelectG b a -> a)
-> (forall a. Num a => AnnRelationSelectG b a -> a)
-> (forall a. Num a => AnnRelationSelectG b a -> a)
-> Foldable (AnnRelationSelectG b)
forall a. Eq a => a -> AnnRelationSelectG b a -> Bool
forall a. Num a => AnnRelationSelectG b a -> a
forall a. Ord a => AnnRelationSelectG b a -> a
forall m. Monoid m => AnnRelationSelectG b m -> m
forall a. AnnRelationSelectG b a -> Bool
forall a. AnnRelationSelectG b a -> Int
forall a. AnnRelationSelectG b a -> [a]
forall a. (a -> a -> a) -> AnnRelationSelectG b a -> a
forall m a. Monoid m => (a -> m) -> AnnRelationSelectG b a -> m
forall b a. (b -> a -> b) -> b -> AnnRelationSelectG b a -> b
forall a b. (a -> b -> b) -> b -> AnnRelationSelectG b a -> b
forall (b :: BackendType) a.
Eq a =>
a -> AnnRelationSelectG b a -> Bool
forall (b :: BackendType) a. Num a => AnnRelationSelectG b a -> a
forall (b :: BackendType) a. Ord a => AnnRelationSelectG b a -> a
forall (b :: BackendType) m.
Monoid m =>
AnnRelationSelectG b m -> m
forall (b :: BackendType) a. AnnRelationSelectG b a -> Bool
forall (b :: BackendType) a. AnnRelationSelectG b a -> Int
forall (b :: BackendType) a. AnnRelationSelectG b a -> [a]
forall (b :: BackendType) a.
(a -> a -> a) -> AnnRelationSelectG b a -> a
forall (b :: BackendType) m a.
Monoid m =>
(a -> m) -> AnnRelationSelectG b a -> m
forall (b :: BackendType) b a.
(b -> a -> b) -> b -> AnnRelationSelectG b a -> b
forall (b :: BackendType) a b.
(a -> b -> b) -> b -> AnnRelationSelectG 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
product :: AnnRelationSelectG b a -> a
$cproduct :: forall (b :: BackendType) a. Num a => AnnRelationSelectG b a -> a
sum :: AnnRelationSelectG b a -> a
$csum :: forall (b :: BackendType) a. Num a => AnnRelationSelectG b a -> a
minimum :: AnnRelationSelectG b a -> a
$cminimum :: forall (b :: BackendType) a. Ord a => AnnRelationSelectG b a -> a
maximum :: AnnRelationSelectG b a -> a
$cmaximum :: forall (b :: BackendType) a. Ord a => AnnRelationSelectG b a -> a
elem :: a -> AnnRelationSelectG b a -> Bool
$celem :: forall (b :: BackendType) a.
Eq a =>
a -> AnnRelationSelectG b a -> Bool
length :: AnnRelationSelectG b a -> Int
$clength :: forall (b :: BackendType) a. AnnRelationSelectG b a -> Int
null :: AnnRelationSelectG b a -> Bool
$cnull :: forall (b :: BackendType) a. AnnRelationSelectG b a -> Bool
toList :: AnnRelationSelectG b a -> [a]
$ctoList :: forall (b :: BackendType) a. AnnRelationSelectG b a -> [a]
foldl1 :: (a -> a -> a) -> AnnRelationSelectG b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
(a -> a -> a) -> AnnRelationSelectG b a -> a
foldr1 :: (a -> a -> a) -> AnnRelationSelectG b a -> a
$cfoldr1 :: forall (b :: BackendType) a.
(a -> a -> a) -> AnnRelationSelectG b a -> a
foldl' :: (b -> a -> b) -> b -> AnnRelationSelectG b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
(b -> a -> b) -> b -> AnnRelationSelectG b a -> b
foldl :: (b -> a -> b) -> b -> AnnRelationSelectG b a -> b
$cfoldl :: forall (b :: BackendType) b a.
(b -> a -> b) -> b -> AnnRelationSelectG b a -> b
foldr' :: (a -> b -> b) -> b -> AnnRelationSelectG b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
(a -> b -> b) -> b -> AnnRelationSelectG b a -> b
foldr :: (a -> b -> b) -> b -> AnnRelationSelectG b a -> b
$cfoldr :: forall (b :: BackendType) a b.
(a -> b -> b) -> b -> AnnRelationSelectG b a -> b
foldMap' :: (a -> m) -> AnnRelationSelectG b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
Monoid m =>
(a -> m) -> AnnRelationSelectG b a -> m
foldMap :: (a -> m) -> AnnRelationSelectG b a -> m
$cfoldMap :: forall (b :: BackendType) m a.
Monoid m =>
(a -> m) -> AnnRelationSelectG b a -> m
fold :: AnnRelationSelectG b m -> m
$cfold :: forall (b :: BackendType) m.
Monoid m =>
AnnRelationSelectG b m -> m
Foldable, Functor (AnnRelationSelectG b)
Foldable (AnnRelationSelectG b)
Functor (AnnRelationSelectG b)
-> Foldable (AnnRelationSelectG b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> AnnRelationSelectG b a -> f (AnnRelationSelectG b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnRelationSelectG b (f a) -> f (AnnRelationSelectG b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> AnnRelationSelectG b a -> m (AnnRelationSelectG b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnRelationSelectG b (m a) -> m (AnnRelationSelectG b a))
-> Traversable (AnnRelationSelectG b)
(a -> f b) -> AnnRelationSelectG b a -> f (AnnRelationSelectG b b)
forall (b :: BackendType). Functor (AnnRelationSelectG b)
forall (b :: BackendType). Foldable (AnnRelationSelectG b)
forall (b :: BackendType) (m :: * -> *) a.
Monad m =>
AnnRelationSelectG b (m a) -> m (AnnRelationSelectG b a)
forall (b :: BackendType) (f :: * -> *) a.
Applicative f =>
AnnRelationSelectG b (f a) -> f (AnnRelationSelectG b a)
forall (b :: BackendType) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnRelationSelectG b a -> m (AnnRelationSelectG b b)
forall (b :: BackendType) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnRelationSelectG b a -> f (AnnRelationSelectG 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 =>
AnnRelationSelectG b (m a) -> m (AnnRelationSelectG b a)
forall (f :: * -> *) a.
Applicative f =>
AnnRelationSelectG b (f a) -> f (AnnRelationSelectG b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnRelationSelectG b a -> m (AnnRelationSelectG b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnRelationSelectG b a -> f (AnnRelationSelectG b b)
sequence :: AnnRelationSelectG b (m a) -> m (AnnRelationSelectG b a)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
Monad m =>
AnnRelationSelectG b (m a) -> m (AnnRelationSelectG b a)
mapM :: (a -> m b) -> AnnRelationSelectG b a -> m (AnnRelationSelectG b b)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnRelationSelectG b a -> m (AnnRelationSelectG b b)
sequenceA :: AnnRelationSelectG b (f a) -> f (AnnRelationSelectG b a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
Applicative f =>
AnnRelationSelectG b (f a) -> f (AnnRelationSelectG b a)
traverse :: (a -> f b) -> AnnRelationSelectG b a -> f (AnnRelationSelectG b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnRelationSelectG b a -> f (AnnRelationSelectG b b)
$cp2Traversable :: forall (b :: BackendType). Foldable (AnnRelationSelectG b)
$cp1Traversable :: forall (b :: BackendType). Functor (AnnRelationSelectG b)
Traversable)

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

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

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
  { AnnObjectSelectG b r v -> AnnFieldsG b r v
_aosFields :: AnnFieldsG b r v,
    AnnObjectSelectG b r v -> TableName b
_aosTableFrom :: TableName b,
    AnnObjectSelectG b r v -> AnnBoolExp b v
_aosTableFilter :: (AnnBoolExp b v)
  }
  deriving stock (a -> AnnObjectSelectG b r b -> AnnObjectSelectG b r a
(a -> b) -> AnnObjectSelectG b r a -> AnnObjectSelectG b r b
(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
<$ :: a -> AnnObjectSelectG b r b -> AnnObjectSelectG b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> AnnObjectSelectG b r b -> AnnObjectSelectG b r a
fmap :: (a -> b) -> AnnObjectSelectG b r a -> AnnObjectSelectG b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> AnnObjectSelectG b r a -> AnnObjectSelectG b r b
Functor, AnnObjectSelectG b r a -> Bool
(a -> m) -> AnnObjectSelectG b r a -> m
(a -> b -> b) -> b -> AnnObjectSelectG b r a -> b
(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
product :: AnnObjectSelectG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnObjectSelectG b r a -> a
sum :: AnnObjectSelectG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnObjectSelectG b r a -> a
minimum :: AnnObjectSelectG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnObjectSelectG b r a -> a
maximum :: AnnObjectSelectG b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnObjectSelectG b r a -> a
elem :: a -> AnnObjectSelectG b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnObjectSelectG b r a -> Bool
length :: AnnObjectSelectG b r a -> Int
$clength :: forall (b :: BackendType) r a.
Backend b =>
AnnObjectSelectG b r a -> Int
null :: AnnObjectSelectG b r a -> Bool
$cnull :: forall (b :: BackendType) r a.
Backend b =>
AnnObjectSelectG b r a -> Bool
toList :: AnnObjectSelectG b r a -> [a]
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
AnnObjectSelectG b r a -> [a]
foldl1 :: (a -> a -> a) -> AnnObjectSelectG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnObjectSelectG b r a -> a
foldr1 :: (a -> a -> a) -> AnnObjectSelectG b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnObjectSelectG b r a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: AnnObjectSelectG b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnObjectSelectG b r m -> m
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)
(a -> f b) -> AnnObjectSelectG b r a -> f (AnnObjectSelectG b r b)
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)
sequence :: AnnObjectSelectG b r (m a) -> m (AnnObjectSelectG b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnObjectSelectG b r (m a) -> m (AnnObjectSelectG b r a)
mapM :: (a -> m b) -> AnnObjectSelectG b r a -> m (AnnObjectSelectG b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnObjectSelectG b r a -> m (AnnObjectSelectG b r b)
sequenceA :: AnnObjectSelectG b r (f a) -> f (AnnObjectSelectG b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnObjectSelectG b r (f a) -> f (AnnObjectSelectG b r a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType) r.
Backend b =>
Foldable (AnnObjectSelectG b r)
$cp1Traversable :: forall (b :: BackendType) r.
Backend b =>
Functor (AnnObjectSelectG b r)
Traversable)

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

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

instance Backend b => Bifoldable (AnnObjectSelectG b) where
  bifoldMap :: (a -> m) -> (b -> m) -> AnnObjectSelectG b a b -> m
bifoldMap a -> m
f b -> m
g AnnObjectSelectG {AnnFieldsG b a b
TableName b
AnnBoolExp b b
_aosTableFilter :: AnnBoolExp b b
_aosTableFrom :: TableName b
_aosFields :: AnnFieldsG b a b
$sel:_aosTableFilter:AnnObjectSelectG :: forall (b :: BackendType) r v.
AnnObjectSelectG b r v -> AnnBoolExp b v
$sel:_aosTableFrom:AnnObjectSelectG :: forall (b :: BackendType) r v.
AnnObjectSelectG b r v -> TableName b
$sel:_aosFields:AnnObjectSelectG :: forall (b :: BackendType) r v.
AnnObjectSelectG b r v -> AnnFieldsG b r v
..} =
    ((FieldName, AnnFieldG b a b) -> m) -> AnnFieldsG b a b -> 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 (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 (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 (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((b -> m) -> AnnBoolExpFld b b -> m
forall (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap b -> m
g) AnnBoolExp b b
_aosTableFilter

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 (a -> ArraySelectG b r b -> ArraySelectG b r a
(a -> b) -> ArraySelectG b r a -> ArraySelectG b r b
(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
<$ :: a -> ArraySelectG b r b -> ArraySelectG b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> ArraySelectG b r b -> ArraySelectG b r a
fmap :: (a -> b) -> ArraySelectG b r a -> ArraySelectG b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> ArraySelectG b r a -> ArraySelectG b r b
Functor, ArraySelectG b r a -> Bool
(a -> m) -> ArraySelectG b r a -> m
(a -> b -> b) -> b -> ArraySelectG b r a -> b
(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
product :: ArraySelectG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ArraySelectG b r a -> a
sum :: ArraySelectG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
ArraySelectG b r a -> a
minimum :: ArraySelectG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ArraySelectG b r a -> a
maximum :: ArraySelectG b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
ArraySelectG b r a -> a
elem :: a -> ArraySelectG b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> ArraySelectG b r a -> Bool
length :: ArraySelectG b r a -> Int
$clength :: forall (b :: BackendType) r a.
Backend b =>
ArraySelectG b r a -> Int
null :: ArraySelectG b r a -> Bool
$cnull :: forall (b :: BackendType) r a.
Backend b =>
ArraySelectG b r a -> Bool
toList :: ArraySelectG b r a -> [a]
$ctoList :: forall (b :: BackendType) r a.
Backend b =>
ArraySelectG b r a -> [a]
foldl1 :: (a -> a -> a) -> ArraySelectG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ArraySelectG b r a -> a
foldr1 :: (a -> a -> a) -> ArraySelectG b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> ArraySelectG b r a -> a
foldl' :: (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 :: (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
foldr' :: (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 :: (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
foldMap' :: (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 :: (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
fold :: ArraySelectG b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
ArraySelectG b r m -> m
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)
(a -> f b) -> ArraySelectG b r a -> f (ArraySelectG b r b)
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)
sequence :: ArraySelectG b r (m a) -> m (ArraySelectG b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
ArraySelectG b r (m a) -> m (ArraySelectG b r a)
mapM :: (a -> m b) -> ArraySelectG b r a -> m (ArraySelectG b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> ArraySelectG b r a -> m (ArraySelectG b r b)
sequenceA :: ArraySelectG b r (f a) -> f (ArraySelectG b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
ArraySelectG b r (f a) -> f (ArraySelectG b r a)
traverse :: (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)
$cp2Traversable :: forall (b :: BackendType) r.
Backend b =>
Foldable (ArraySelectG b r)
$cp1Traversable :: forall (b :: BackendType) r.
Backend b =>
Functor (ArraySelectG b r)
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 :: (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 (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 (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 (t :: * -> *) m a.
(Foldable t, Monoid m) =>
(a -> m) -> t a -> m
foldMap ((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
  { RemoteSourceSelect r vf tgt -> SourceName
_rssName :: SourceName,
    RemoteSourceSelect r vf tgt -> SourceConfig tgt
_rssConfig :: SourceConfig tgt,
    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
    RemoteSourceSelect r vf tgt
-> HashMap FieldName (ScalarType tgt, Column tgt)
_rssJoinMapping :: (HM.HashMap FieldName (ScalarType tgt, Column tgt))
  }

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

-- Permissions

data TablePermG (b :: BackendType) v = TablePerm
  { TablePermG b v -> AnnBoolExp b v
_tpFilter :: AnnBoolExp b v,
    TablePermG b v -> Maybe Int
_tpLimit :: (Maybe Int)
  }
  deriving stock ((forall x. TablePermG b v -> Rep (TablePermG b v) x)
-> (forall x. Rep (TablePermG b v) x -> TablePermG b v)
-> Generic (TablePermG b v)
forall x. Rep (TablePermG b v) x -> TablePermG b v
forall x. TablePermG b v -> Rep (TablePermG 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 (TablePermG b v) x -> TablePermG b v
forall (b :: BackendType) v x.
TablePermG b v -> Rep (TablePermG b v) x
$cto :: forall (b :: BackendType) v x.
Rep (TablePermG b v) x -> TablePermG b v
$cfrom :: forall (b :: BackendType) v x.
TablePermG b v -> Rep (TablePermG b v) x
Generic, a -> TablePermG b b -> TablePermG b a
(a -> b) -> TablePermG b a -> TablePermG b b
(forall a b. (a -> b) -> TablePermG b a -> TablePermG b b)
-> (forall a b. a -> TablePermG b b -> TablePermG b a)
-> Functor (TablePermG b)
forall a b. a -> TablePermG b b -> TablePermG b a
forall a b. (a -> b) -> TablePermG b a -> TablePermG b b
forall (b :: BackendType) a b.
Backend b =>
a -> TablePermG b b -> TablePermG b a
forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> TablePermG b a -> TablePermG b b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> TablePermG b b -> TablePermG b a
$c<$ :: forall (b :: BackendType) a b.
Backend b =>
a -> TablePermG b b -> TablePermG b a
fmap :: (a -> b) -> TablePermG b a -> TablePermG b b
$cfmap :: forall (b :: BackendType) a b.
Backend b =>
(a -> b) -> TablePermG b a -> TablePermG b b
Functor, TablePermG b a -> Bool
(a -> m) -> TablePermG b a -> m
(a -> b -> b) -> b -> TablePermG b a -> b
(forall m. Monoid m => TablePermG b m -> m)
-> (forall m a. Monoid m => (a -> m) -> TablePermG b a -> m)
-> (forall m a. Monoid m => (a -> m) -> TablePermG b a -> m)
-> (forall a b. (a -> b -> b) -> b -> TablePermG b a -> b)
-> (forall a b. (a -> b -> b) -> b -> TablePermG b a -> b)
-> (forall b a. (b -> a -> b) -> b -> TablePermG b a -> b)
-> (forall b a. (b -> a -> b) -> b -> TablePermG b a -> b)
-> (forall a. (a -> a -> a) -> TablePermG b a -> a)
-> (forall a. (a -> a -> a) -> TablePermG b a -> a)
-> (forall a. TablePermG b a -> [a])
-> (forall a. TablePermG b a -> Bool)
-> (forall a. TablePermG b a -> Int)
-> (forall a. Eq a => a -> TablePermG b a -> Bool)
-> (forall a. Ord a => TablePermG b a -> a)
-> (forall a. Ord a => TablePermG b a -> a)
-> (forall a. Num a => TablePermG b a -> a)
-> (forall a. Num a => TablePermG b a -> a)
-> Foldable (TablePermG b)
forall a. Eq a => a -> TablePermG b a -> Bool
forall a. Num a => TablePermG b a -> a
forall a. Ord a => TablePermG b a -> a
forall m. Monoid m => TablePermG b m -> m
forall a. TablePermG b a -> Bool
forall a. TablePermG b a -> Int
forall a. TablePermG b a -> [a]
forall a. (a -> a -> a) -> TablePermG b a -> a
forall m a. Monoid m => (a -> m) -> TablePermG b a -> m
forall b a. (b -> a -> b) -> b -> TablePermG b a -> b
forall a b. (a -> b -> b) -> b -> TablePermG b a -> b
forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> TablePermG b a -> Bool
forall (b :: BackendType) a.
(Backend b, Num a) =>
TablePermG b a -> a
forall (b :: BackendType) a.
(Backend b, Ord a) =>
TablePermG b a -> a
forall (b :: BackendType) m.
(Backend b, Monoid m) =>
TablePermG b m -> m
forall (b :: BackendType) a. Backend b => TablePermG b a -> Bool
forall (b :: BackendType) a. Backend b => TablePermG b a -> Int
forall (b :: BackendType) a. Backend b => TablePermG b a -> [a]
forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> TablePermG b a -> a
forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> TablePermG b a -> m
forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> TablePermG b a -> b
forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> TablePermG 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
product :: TablePermG b a -> a
$cproduct :: forall (b :: BackendType) a.
(Backend b, Num a) =>
TablePermG b a -> a
sum :: TablePermG b a -> a
$csum :: forall (b :: BackendType) a.
(Backend b, Num a) =>
TablePermG b a -> a
minimum :: TablePermG b a -> a
$cminimum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
TablePermG b a -> a
maximum :: TablePermG b a -> a
$cmaximum :: forall (b :: BackendType) a.
(Backend b, Ord a) =>
TablePermG b a -> a
elem :: a -> TablePermG b a -> Bool
$celem :: forall (b :: BackendType) a.
(Backend b, Eq a) =>
a -> TablePermG b a -> Bool
length :: TablePermG b a -> Int
$clength :: forall (b :: BackendType) a. Backend b => TablePermG b a -> Int
null :: TablePermG b a -> Bool
$cnull :: forall (b :: BackendType) a. Backend b => TablePermG b a -> Bool
toList :: TablePermG b a -> [a]
$ctoList :: forall (b :: BackendType) a. Backend b => TablePermG b a -> [a]
foldl1 :: (a -> a -> a) -> TablePermG b a -> a
$cfoldl1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> TablePermG b a -> a
foldr1 :: (a -> a -> a) -> TablePermG b a -> a
$cfoldr1 :: forall (b :: BackendType) a.
Backend b =>
(a -> a -> a) -> TablePermG b a -> a
foldl' :: (b -> a -> b) -> b -> TablePermG b a -> b
$cfoldl' :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> TablePermG b a -> b
foldl :: (b -> a -> b) -> b -> TablePermG b a -> b
$cfoldl :: forall (b :: BackendType) b a.
Backend b =>
(b -> a -> b) -> b -> TablePermG b a -> b
foldr' :: (a -> b -> b) -> b -> TablePermG b a -> b
$cfoldr' :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> TablePermG b a -> b
foldr :: (a -> b -> b) -> b -> TablePermG b a -> b
$cfoldr :: forall (b :: BackendType) a b.
Backend b =>
(a -> b -> b) -> b -> TablePermG b a -> b
foldMap' :: (a -> m) -> TablePermG b a -> m
$cfoldMap' :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> TablePermG b a -> m
foldMap :: (a -> m) -> TablePermG b a -> m
$cfoldMap :: forall (b :: BackendType) m a.
(Backend b, Monoid m) =>
(a -> m) -> TablePermG b a -> m
fold :: TablePermG b m -> m
$cfold :: forall (b :: BackendType) m.
(Backend b, Monoid m) =>
TablePermG b m -> m
Foldable, Functor (TablePermG b)
Foldable (TablePermG b)
Functor (TablePermG b)
-> Foldable (TablePermG b)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> TablePermG b a -> f (TablePermG b b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    TablePermG b (f a) -> f (TablePermG b a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> TablePermG b a -> m (TablePermG b b))
-> (forall (m :: * -> *) a.
    Monad m =>
    TablePermG b (m a) -> m (TablePermG b a))
-> Traversable (TablePermG b)
(a -> f b) -> TablePermG b a -> f (TablePermG b b)
forall (b :: BackendType). Backend b => Functor (TablePermG b)
forall (b :: BackendType). Backend b => Foldable (TablePermG b)
forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
TablePermG b (m a) -> m (TablePermG b a)
forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
TablePermG b (f a) -> f (TablePermG b a)
forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> TablePermG b a -> m (TablePermG b b)
forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> TablePermG b a -> f (TablePermG 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 =>
TablePermG b (m a) -> m (TablePermG b a)
forall (f :: * -> *) a.
Applicative f =>
TablePermG b (f a) -> f (TablePermG b a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> TablePermG b a -> m (TablePermG b b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> TablePermG b a -> f (TablePermG b b)
sequence :: TablePermG b (m a) -> m (TablePermG b a)
$csequence :: forall (b :: BackendType) (m :: * -> *) a.
(Backend b, Monad m) =>
TablePermG b (m a) -> m (TablePermG b a)
mapM :: (a -> m b) -> TablePermG b a -> m (TablePermG b b)
$cmapM :: forall (b :: BackendType) (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> TablePermG b a -> m (TablePermG b b)
sequenceA :: TablePermG b (f a) -> f (TablePermG b a)
$csequenceA :: forall (b :: BackendType) (f :: * -> *) a.
(Backend b, Applicative f) =>
TablePermG b (f a) -> f (TablePermG b a)
traverse :: (a -> f b) -> TablePermG b a -> f (TablePermG b b)
$ctraverse :: forall (b :: BackendType) (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> TablePermG b a -> f (TablePermG b b)
$cp2Traversable :: forall (b :: BackendType). Backend b => Foldable (TablePermG b)
$cp1Traversable :: forall (b :: BackendType). Backend b => Functor (TablePermG b)
Traversable)

deriving stock instance
  ( Backend b,
    Eq (AnnBoolExp b v)
  ) =>
  Eq (TablePermG b v)

deriving stock instance
  ( Backend b,
    Show (AnnBoolExp b v)
  ) =>
  Show (TablePermG b v)

instance
  ( Backend b,
    Hashable (AnnBoolExp b v)
  ) =>
  Hashable (TablePermG b v)

type TablePerm b = TablePermG b (SQLExpression b)

noTablePermissions :: TablePermG backend v
noTablePermissions :: TablePermG backend v
noTablePermissions = AnnBoolExp backend v -> Maybe Int -> TablePermG backend v
forall (b :: BackendType) v.
AnnBoolExp b v -> Maybe Int -> TablePermG b v
TablePerm AnnBoolExp backend v
forall (backend :: BackendType) scalar. AnnBoolExp backend scalar
annBoolExpTrue Maybe Int
forall a. Maybe a
Nothing

-- | 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 :: 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 (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
HM.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 (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

-- Lenses

$(makeLenses ''AnnSelectG)
$(makeLenses ''AnnObjectSelectG)
$(makeLenses ''AnnRelationSelectG)
$(makeLenses ''ConnectionSelect)
$(makeLenses ''SelectArgsG)
$(makePrisms ''AnnFieldG)
$(makePrisms ''AnnotatedOrderByElement)
$(makePrisms ''TableAggregateFieldG)
$(makePrisms ''ConnectionField)
$(makePrisms ''EdgeField)