{-# LANGUAGE DeriveAnyClass #-}

module Hasura.Backends.DataConnector.IR.Aggregate
  ( Aggregate (..),
    SingleColumnAggregate (..),
    SingleColumnAggregateFunction (..),
    CountAggregate (..),
  )
where

import Data.Aeson (FromJSON, ToJSON)
import Hasura.Backends.DataConnector.API qualified as API
import Hasura.Backends.DataConnector.IR.Column qualified as IR.C
import Hasura.Incremental (Cacheable)
import Hasura.Prelude
import Witch qualified

data Aggregate
  = SingleColumn SingleColumnAggregate
  | Count CountAggregate
  deriving stock (Typeable Aggregate
DataType
Constr
Typeable Aggregate
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> Aggregate -> c Aggregate)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c Aggregate)
-> (Aggregate -> Constr)
-> (Aggregate -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c Aggregate))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Aggregate))
-> ((forall b. Data b => b -> b) -> Aggregate -> Aggregate)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Aggregate -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Aggregate -> r)
-> (forall u. (forall d. Data d => d -> u) -> Aggregate -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Aggregate -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Aggregate -> m Aggregate)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Aggregate -> m Aggregate)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Aggregate -> m Aggregate)
-> Data Aggregate
Aggregate -> DataType
Aggregate -> Constr
(forall b. Data b => b -> b) -> Aggregate -> Aggregate
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Aggregate -> c Aggregate
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Aggregate
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Aggregate -> u
forall u. (forall d. Data d => d -> u) -> Aggregate -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Aggregate -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Aggregate -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Aggregate -> m Aggregate
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Aggregate -> m Aggregate
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Aggregate
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Aggregate -> c Aggregate
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Aggregate)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Aggregate)
$cCount :: Constr
$cSingleColumn :: Constr
$tAggregate :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Aggregate -> m Aggregate
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Aggregate -> m Aggregate
gmapMp :: (forall d. Data d => d -> m d) -> Aggregate -> m Aggregate
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Aggregate -> m Aggregate
gmapM :: (forall d. Data d => d -> m d) -> Aggregate -> m Aggregate
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Aggregate -> m Aggregate
gmapQi :: Int -> (forall d. Data d => d -> u) -> Aggregate -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Aggregate -> u
gmapQ :: (forall d. Data d => d -> u) -> Aggregate -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Aggregate -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Aggregate -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Aggregate -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Aggregate -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Aggregate -> r
gmapT :: (forall b. Data b => b -> b) -> Aggregate -> Aggregate
$cgmapT :: (forall b. Data b => b -> b) -> Aggregate -> Aggregate
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Aggregate)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Aggregate)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Aggregate)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Aggregate)
dataTypeOf :: Aggregate -> DataType
$cdataTypeOf :: Aggregate -> DataType
toConstr :: Aggregate -> Constr
$ctoConstr :: Aggregate -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Aggregate
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Aggregate
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Aggregate -> c Aggregate
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Aggregate -> c Aggregate
$cp1Data :: Typeable Aggregate
Data, Aggregate -> Aggregate -> Bool
(Aggregate -> Aggregate -> Bool)
-> (Aggregate -> Aggregate -> Bool) -> Eq Aggregate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Aggregate -> Aggregate -> Bool
$c/= :: Aggregate -> Aggregate -> Bool
== :: Aggregate -> Aggregate -> Bool
$c== :: Aggregate -> Aggregate -> Bool
Eq, (forall x. Aggregate -> Rep Aggregate x)
-> (forall x. Rep Aggregate x -> Aggregate) -> Generic Aggregate
forall x. Rep Aggregate x -> Aggregate
forall x. Aggregate -> Rep Aggregate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Aggregate x -> Aggregate
$cfrom :: forall x. Aggregate -> Rep Aggregate x
Generic, Eq Aggregate
Eq Aggregate
-> (Aggregate -> Aggregate -> Ordering)
-> (Aggregate -> Aggregate -> Bool)
-> (Aggregate -> Aggregate -> Bool)
-> (Aggregate -> Aggregate -> Bool)
-> (Aggregate -> Aggregate -> Bool)
-> (Aggregate -> Aggregate -> Aggregate)
-> (Aggregate -> Aggregate -> Aggregate)
-> Ord Aggregate
Aggregate -> Aggregate -> Bool
Aggregate -> Aggregate -> Ordering
Aggregate -> Aggregate -> Aggregate
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Aggregate -> Aggregate -> Aggregate
$cmin :: Aggregate -> Aggregate -> Aggregate
max :: Aggregate -> Aggregate -> Aggregate
$cmax :: Aggregate -> Aggregate -> Aggregate
>= :: Aggregate -> Aggregate -> Bool
$c>= :: Aggregate -> Aggregate -> Bool
> :: Aggregate -> Aggregate -> Bool
$c> :: Aggregate -> Aggregate -> Bool
<= :: Aggregate -> Aggregate -> Bool
$c<= :: Aggregate -> Aggregate -> Bool
< :: Aggregate -> Aggregate -> Bool
$c< :: Aggregate -> Aggregate -> Bool
compare :: Aggregate -> Aggregate -> Ordering
$ccompare :: Aggregate -> Aggregate -> Ordering
$cp1Ord :: Eq Aggregate
Ord, Int -> Aggregate -> ShowS
[Aggregate] -> ShowS
Aggregate -> String
(Int -> Aggregate -> ShowS)
-> (Aggregate -> String)
-> ([Aggregate] -> ShowS)
-> Show Aggregate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Aggregate] -> ShowS
$cshowList :: [Aggregate] -> ShowS
show :: Aggregate -> String
$cshow :: Aggregate -> String
showsPrec :: Int -> Aggregate -> ShowS
$cshowsPrec :: Int -> Aggregate -> ShowS
Show)
  deriving anyclass (Eq Aggregate
Eq Aggregate
-> (Accesses -> Aggregate -> Aggregate -> Bool)
-> Cacheable Aggregate
Accesses -> Aggregate -> Aggregate -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> Aggregate -> Aggregate -> Bool
$cunchanged :: Accesses -> Aggregate -> Aggregate -> Bool
$cp1Cacheable :: Eq Aggregate
Cacheable, Value -> Parser [Aggregate]
Value -> Parser Aggregate
(Value -> Parser Aggregate)
-> (Value -> Parser [Aggregate]) -> FromJSON Aggregate
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [Aggregate]
$cparseJSONList :: Value -> Parser [Aggregate]
parseJSON :: Value -> Parser Aggregate
$cparseJSON :: Value -> Parser Aggregate
FromJSON, Int -> Aggregate -> Int
Aggregate -> Int
(Int -> Aggregate -> Int)
-> (Aggregate -> Int) -> Hashable Aggregate
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Aggregate -> Int
$chash :: Aggregate -> Int
hashWithSalt :: Int -> Aggregate -> Int
$chashWithSalt :: Int -> Aggregate -> Int
Hashable, Aggregate -> ()
(Aggregate -> ()) -> NFData Aggregate
forall a. (a -> ()) -> NFData a
rnf :: Aggregate -> ()
$crnf :: Aggregate -> ()
NFData, [Aggregate] -> Value
[Aggregate] -> Encoding
Aggregate -> Value
Aggregate -> Encoding
(Aggregate -> Value)
-> (Aggregate -> Encoding)
-> ([Aggregate] -> Value)
-> ([Aggregate] -> Encoding)
-> ToJSON Aggregate
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [Aggregate] -> Encoding
$ctoEncodingList :: [Aggregate] -> Encoding
toJSONList :: [Aggregate] -> Value
$ctoJSONList :: [Aggregate] -> Value
toEncoding :: Aggregate -> Encoding
$ctoEncoding :: Aggregate -> Encoding
toJSON :: Aggregate -> Value
$ctoJSON :: Aggregate -> Value
ToJSON)

instance Witch.From Aggregate API.Aggregate where
  from :: Aggregate -> Aggregate
from (SingleColumn SingleColumnAggregate
singleColumn) = SingleColumnAggregate -> Aggregate
API.SingleColumn (SingleColumnAggregate -> SingleColumnAggregate
forall source target. From source target => source -> target
Witch.from SingleColumnAggregate
singleColumn)
  from (Count CountAggregate
StarCount) = Aggregate
API.StarCount
  from (Count (ColumnCount Name
column)) = ColumnCountAggregate -> Aggregate
API.ColumnCount (ColumnCountAggregate -> Aggregate)
-> ColumnCountAggregate -> Aggregate
forall a b. (a -> b) -> a -> b
$ ColumnCountAggregate :: ColumnName -> Bool -> ColumnCountAggregate
API.ColumnCountAggregate {_ccaColumn :: ColumnName
_ccaColumn = Name -> ColumnName
forall source target. From source target => source -> target
Witch.from Name
column, _ccaDistinct :: Bool
_ccaDistinct = Bool
False}
  from (Count (ColumnDistinctCount Name
column)) = ColumnCountAggregate -> Aggregate
API.ColumnCount (ColumnCountAggregate -> Aggregate)
-> ColumnCountAggregate -> Aggregate
forall a b. (a -> b) -> a -> b
$ ColumnCountAggregate :: ColumnName -> Bool -> ColumnCountAggregate
API.ColumnCountAggregate {_ccaColumn :: ColumnName
_ccaColumn = Name -> ColumnName
forall source target. From source target => source -> target
Witch.from Name
column, _ccaDistinct :: Bool
_ccaDistinct = Bool
True}

data SingleColumnAggregate = SingleColumnAggregate
  { SingleColumnAggregate -> SingleColumnAggregateFunction
_scaFunction :: SingleColumnAggregateFunction,
    SingleColumnAggregate -> Name
_scaColumn :: IR.C.Name
  }
  deriving stock (Typeable SingleColumnAggregate
DataType
Constr
Typeable SingleColumnAggregate
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> SingleColumnAggregate
    -> c SingleColumnAggregate)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c SingleColumnAggregate)
-> (SingleColumnAggregate -> Constr)
-> (SingleColumnAggregate -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c SingleColumnAggregate))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c SingleColumnAggregate))
-> ((forall b. Data b => b -> b)
    -> SingleColumnAggregate -> SingleColumnAggregate)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SingleColumnAggregate
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SingleColumnAggregate
    -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> SingleColumnAggregate -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> SingleColumnAggregate -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> SingleColumnAggregate -> m SingleColumnAggregate)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SingleColumnAggregate -> m SingleColumnAggregate)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SingleColumnAggregate -> m SingleColumnAggregate)
-> Data SingleColumnAggregate
SingleColumnAggregate -> DataType
SingleColumnAggregate -> Constr
(forall b. Data b => b -> b)
-> SingleColumnAggregate -> SingleColumnAggregate
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SingleColumnAggregate
-> c SingleColumnAggregate
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SingleColumnAggregate
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> SingleColumnAggregate -> u
forall u.
(forall d. Data d => d -> u) -> SingleColumnAggregate -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SingleColumnAggregate -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SingleColumnAggregate -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregate -> m SingleColumnAggregate
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregate -> m SingleColumnAggregate
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SingleColumnAggregate
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SingleColumnAggregate
-> c SingleColumnAggregate
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SingleColumnAggregate)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SingleColumnAggregate)
$cSingleColumnAggregate :: Constr
$tSingleColumnAggregate :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> SingleColumnAggregate -> m SingleColumnAggregate
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregate -> m SingleColumnAggregate
gmapMp :: (forall d. Data d => d -> m d)
-> SingleColumnAggregate -> m SingleColumnAggregate
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregate -> m SingleColumnAggregate
gmapM :: (forall d. Data d => d -> m d)
-> SingleColumnAggregate -> m SingleColumnAggregate
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregate -> m SingleColumnAggregate
gmapQi :: Int -> (forall d. Data d => d -> u) -> SingleColumnAggregate -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> SingleColumnAggregate -> u
gmapQ :: (forall d. Data d => d -> u) -> SingleColumnAggregate -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> SingleColumnAggregate -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SingleColumnAggregate -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SingleColumnAggregate -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SingleColumnAggregate -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SingleColumnAggregate -> r
gmapT :: (forall b. Data b => b -> b)
-> SingleColumnAggregate -> SingleColumnAggregate
$cgmapT :: (forall b. Data b => b -> b)
-> SingleColumnAggregate -> SingleColumnAggregate
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SingleColumnAggregate)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SingleColumnAggregate)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c SingleColumnAggregate)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SingleColumnAggregate)
dataTypeOf :: SingleColumnAggregate -> DataType
$cdataTypeOf :: SingleColumnAggregate -> DataType
toConstr :: SingleColumnAggregate -> Constr
$ctoConstr :: SingleColumnAggregate -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SingleColumnAggregate
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SingleColumnAggregate
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SingleColumnAggregate
-> c SingleColumnAggregate
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SingleColumnAggregate
-> c SingleColumnAggregate
$cp1Data :: Typeable SingleColumnAggregate
Data, SingleColumnAggregate -> SingleColumnAggregate -> Bool
(SingleColumnAggregate -> SingleColumnAggregate -> Bool)
-> (SingleColumnAggregate -> SingleColumnAggregate -> Bool)
-> Eq SingleColumnAggregate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
$c/= :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
== :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
$c== :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
Eq, (forall x. SingleColumnAggregate -> Rep SingleColumnAggregate x)
-> (forall x. Rep SingleColumnAggregate x -> SingleColumnAggregate)
-> Generic SingleColumnAggregate
forall x. Rep SingleColumnAggregate x -> SingleColumnAggregate
forall x. SingleColumnAggregate -> Rep SingleColumnAggregate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SingleColumnAggregate x -> SingleColumnAggregate
$cfrom :: forall x. SingleColumnAggregate -> Rep SingleColumnAggregate x
Generic, Eq SingleColumnAggregate
Eq SingleColumnAggregate
-> (SingleColumnAggregate -> SingleColumnAggregate -> Ordering)
-> (SingleColumnAggregate -> SingleColumnAggregate -> Bool)
-> (SingleColumnAggregate -> SingleColumnAggregate -> Bool)
-> (SingleColumnAggregate -> SingleColumnAggregate -> Bool)
-> (SingleColumnAggregate -> SingleColumnAggregate -> Bool)
-> (SingleColumnAggregate
    -> SingleColumnAggregate -> SingleColumnAggregate)
-> (SingleColumnAggregate
    -> SingleColumnAggregate -> SingleColumnAggregate)
-> Ord SingleColumnAggregate
SingleColumnAggregate -> SingleColumnAggregate -> Bool
SingleColumnAggregate -> SingleColumnAggregate -> Ordering
SingleColumnAggregate
-> SingleColumnAggregate -> SingleColumnAggregate
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SingleColumnAggregate
-> SingleColumnAggregate -> SingleColumnAggregate
$cmin :: SingleColumnAggregate
-> SingleColumnAggregate -> SingleColumnAggregate
max :: SingleColumnAggregate
-> SingleColumnAggregate -> SingleColumnAggregate
$cmax :: SingleColumnAggregate
-> SingleColumnAggregate -> SingleColumnAggregate
>= :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
$c>= :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
> :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
$c> :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
<= :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
$c<= :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
< :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
$c< :: SingleColumnAggregate -> SingleColumnAggregate -> Bool
compare :: SingleColumnAggregate -> SingleColumnAggregate -> Ordering
$ccompare :: SingleColumnAggregate -> SingleColumnAggregate -> Ordering
$cp1Ord :: Eq SingleColumnAggregate
Ord, Int -> SingleColumnAggregate -> ShowS
[SingleColumnAggregate] -> ShowS
SingleColumnAggregate -> String
(Int -> SingleColumnAggregate -> ShowS)
-> (SingleColumnAggregate -> String)
-> ([SingleColumnAggregate] -> ShowS)
-> Show SingleColumnAggregate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SingleColumnAggregate] -> ShowS
$cshowList :: [SingleColumnAggregate] -> ShowS
show :: SingleColumnAggregate -> String
$cshow :: SingleColumnAggregate -> String
showsPrec :: Int -> SingleColumnAggregate -> ShowS
$cshowsPrec :: Int -> SingleColumnAggregate -> ShowS
Show)
  deriving anyclass (Eq SingleColumnAggregate
Eq SingleColumnAggregate
-> (Accesses
    -> SingleColumnAggregate -> SingleColumnAggregate -> Bool)
-> Cacheable SingleColumnAggregate
Accesses -> SingleColumnAggregate -> SingleColumnAggregate -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> SingleColumnAggregate -> SingleColumnAggregate -> Bool
$cunchanged :: Accesses -> SingleColumnAggregate -> SingleColumnAggregate -> Bool
$cp1Cacheable :: Eq SingleColumnAggregate
Cacheable, Value -> Parser [SingleColumnAggregate]
Value -> Parser SingleColumnAggregate
(Value -> Parser SingleColumnAggregate)
-> (Value -> Parser [SingleColumnAggregate])
-> FromJSON SingleColumnAggregate
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [SingleColumnAggregate]
$cparseJSONList :: Value -> Parser [SingleColumnAggregate]
parseJSON :: Value -> Parser SingleColumnAggregate
$cparseJSON :: Value -> Parser SingleColumnAggregate
FromJSON, Int -> SingleColumnAggregate -> Int
SingleColumnAggregate -> Int
(Int -> SingleColumnAggregate -> Int)
-> (SingleColumnAggregate -> Int) -> Hashable SingleColumnAggregate
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: SingleColumnAggregate -> Int
$chash :: SingleColumnAggregate -> Int
hashWithSalt :: Int -> SingleColumnAggregate -> Int
$chashWithSalt :: Int -> SingleColumnAggregate -> Int
Hashable, SingleColumnAggregate -> ()
(SingleColumnAggregate -> ()) -> NFData SingleColumnAggregate
forall a. (a -> ()) -> NFData a
rnf :: SingleColumnAggregate -> ()
$crnf :: SingleColumnAggregate -> ()
NFData, [SingleColumnAggregate] -> Value
[SingleColumnAggregate] -> Encoding
SingleColumnAggregate -> Value
SingleColumnAggregate -> Encoding
(SingleColumnAggregate -> Value)
-> (SingleColumnAggregate -> Encoding)
-> ([SingleColumnAggregate] -> Value)
-> ([SingleColumnAggregate] -> Encoding)
-> ToJSON SingleColumnAggregate
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [SingleColumnAggregate] -> Encoding
$ctoEncodingList :: [SingleColumnAggregate] -> Encoding
toJSONList :: [SingleColumnAggregate] -> Value
$ctoJSONList :: [SingleColumnAggregate] -> Value
toEncoding :: SingleColumnAggregate -> Encoding
$ctoEncoding :: SingleColumnAggregate -> Encoding
toJSON :: SingleColumnAggregate -> Value
$ctoJSON :: SingleColumnAggregate -> Value
ToJSON)

instance Witch.From SingleColumnAggregate API.SingleColumnAggregate where
  from :: SingleColumnAggregate -> SingleColumnAggregate
from SingleColumnAggregate {Name
SingleColumnAggregateFunction
_scaColumn :: Name
_scaFunction :: SingleColumnAggregateFunction
_scaColumn :: SingleColumnAggregate -> Name
_scaFunction :: SingleColumnAggregate -> SingleColumnAggregateFunction
..} = SingleColumnAggregateFunction
-> ColumnName -> SingleColumnAggregate
API.SingleColumnAggregate (SingleColumnAggregateFunction -> SingleColumnAggregateFunction
forall source target. From source target => source -> target
Witch.from SingleColumnAggregateFunction
_scaFunction) (Name -> ColumnName
forall source target. From source target => source -> target
Witch.from Name
_scaColumn)

data SingleColumnAggregateFunction
  = Average
  | Max
  | Min
  | StandardDeviationPopulation
  | StandardDeviationSample
  | Sum
  | VariancePopulation
  | VarianceSample
  deriving stock (Typeable SingleColumnAggregateFunction
DataType
Constr
Typeable SingleColumnAggregateFunction
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g)
    -> SingleColumnAggregateFunction
    -> c SingleColumnAggregateFunction)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r)
    -> Constr
    -> c SingleColumnAggregateFunction)
-> (SingleColumnAggregateFunction -> Constr)
-> (SingleColumnAggregateFunction -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d))
    -> Maybe (c SingleColumnAggregateFunction))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c SingleColumnAggregateFunction))
-> ((forall b. Data b => b -> b)
    -> SingleColumnAggregateFunction -> SingleColumnAggregateFunction)
-> (forall r r'.
    (r -> r' -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SingleColumnAggregateFunction
    -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r
    -> (forall d. Data d => d -> r')
    -> SingleColumnAggregateFunction
    -> r)
-> (forall u.
    (forall d. Data d => d -> u)
    -> SingleColumnAggregateFunction -> [u])
-> (forall u.
    Int
    -> (forall d. Data d => d -> u)
    -> SingleColumnAggregateFunction
    -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> SingleColumnAggregateFunction
    -> m SingleColumnAggregateFunction)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SingleColumnAggregateFunction
    -> m SingleColumnAggregateFunction)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> SingleColumnAggregateFunction
    -> m SingleColumnAggregateFunction)
-> Data SingleColumnAggregateFunction
SingleColumnAggregateFunction -> DataType
SingleColumnAggregateFunction -> Constr
(forall b. Data b => b -> b)
-> SingleColumnAggregateFunction -> SingleColumnAggregateFunction
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SingleColumnAggregateFunction
-> c SingleColumnAggregateFunction
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c SingleColumnAggregateFunction
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int
-> (forall d. Data d => d -> u)
-> SingleColumnAggregateFunction
-> u
forall u.
(forall d. Data d => d -> u)
-> SingleColumnAggregateFunction -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> SingleColumnAggregateFunction
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> SingleColumnAggregateFunction
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregateFunction -> m SingleColumnAggregateFunction
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregateFunction -> m SingleColumnAggregateFunction
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c SingleColumnAggregateFunction
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SingleColumnAggregateFunction
-> c SingleColumnAggregateFunction
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c SingleColumnAggregateFunction)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SingleColumnAggregateFunction)
$cVarianceSample :: Constr
$cVariancePopulation :: Constr
$cSum :: Constr
$cStandardDeviationSample :: Constr
$cStandardDeviationPopulation :: Constr
$cMin :: Constr
$cMax :: Constr
$cAverage :: Constr
$tSingleColumnAggregateFunction :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> SingleColumnAggregateFunction -> m SingleColumnAggregateFunction
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregateFunction -> m SingleColumnAggregateFunction
gmapMp :: (forall d. Data d => d -> m d)
-> SingleColumnAggregateFunction -> m SingleColumnAggregateFunction
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregateFunction -> m SingleColumnAggregateFunction
gmapM :: (forall d. Data d => d -> m d)
-> SingleColumnAggregateFunction -> m SingleColumnAggregateFunction
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SingleColumnAggregateFunction -> m SingleColumnAggregateFunction
gmapQi :: Int
-> (forall d. Data d => d -> u)
-> SingleColumnAggregateFunction
-> u
$cgmapQi :: forall u.
Int
-> (forall d. Data d => d -> u)
-> SingleColumnAggregateFunction
-> u
gmapQ :: (forall d. Data d => d -> u)
-> SingleColumnAggregateFunction -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u)
-> SingleColumnAggregateFunction -> [u]
gmapQr :: (r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> SingleColumnAggregateFunction
-> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> SingleColumnAggregateFunction
-> r
gmapQl :: (r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> SingleColumnAggregateFunction
-> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> SingleColumnAggregateFunction
-> r
gmapT :: (forall b. Data b => b -> b)
-> SingleColumnAggregateFunction -> SingleColumnAggregateFunction
$cgmapT :: (forall b. Data b => b -> b)
-> SingleColumnAggregateFunction -> SingleColumnAggregateFunction
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SingleColumnAggregateFunction)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c SingleColumnAggregateFunction)
dataCast1 :: (forall d. Data d => c (t d))
-> Maybe (c SingleColumnAggregateFunction)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c SingleColumnAggregateFunction)
dataTypeOf :: SingleColumnAggregateFunction -> DataType
$cdataTypeOf :: SingleColumnAggregateFunction -> DataType
toConstr :: SingleColumnAggregateFunction -> Constr
$ctoConstr :: SingleColumnAggregateFunction -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c SingleColumnAggregateFunction
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r)
-> Constr
-> c SingleColumnAggregateFunction
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SingleColumnAggregateFunction
-> c SingleColumnAggregateFunction
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SingleColumnAggregateFunction
-> c SingleColumnAggregateFunction
$cp1Data :: Typeable SingleColumnAggregateFunction
Data, SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
(SingleColumnAggregateFunction
 -> SingleColumnAggregateFunction -> Bool)
-> (SingleColumnAggregateFunction
    -> SingleColumnAggregateFunction -> Bool)
-> Eq SingleColumnAggregateFunction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
$c/= :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
== :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
$c== :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
Eq, (forall x.
 SingleColumnAggregateFunction
 -> Rep SingleColumnAggregateFunction x)
-> (forall x.
    Rep SingleColumnAggregateFunction x
    -> SingleColumnAggregateFunction)
-> Generic SingleColumnAggregateFunction
forall x.
Rep SingleColumnAggregateFunction x
-> SingleColumnAggregateFunction
forall x.
SingleColumnAggregateFunction
-> Rep SingleColumnAggregateFunction x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SingleColumnAggregateFunction x
-> SingleColumnAggregateFunction
$cfrom :: forall x.
SingleColumnAggregateFunction
-> Rep SingleColumnAggregateFunction x
Generic, Eq SingleColumnAggregateFunction
Eq SingleColumnAggregateFunction
-> (SingleColumnAggregateFunction
    -> SingleColumnAggregateFunction -> Ordering)
-> (SingleColumnAggregateFunction
    -> SingleColumnAggregateFunction -> Bool)
-> (SingleColumnAggregateFunction
    -> SingleColumnAggregateFunction -> Bool)
-> (SingleColumnAggregateFunction
    -> SingleColumnAggregateFunction -> Bool)
-> (SingleColumnAggregateFunction
    -> SingleColumnAggregateFunction -> Bool)
-> (SingleColumnAggregateFunction
    -> SingleColumnAggregateFunction -> SingleColumnAggregateFunction)
-> (SingleColumnAggregateFunction
    -> SingleColumnAggregateFunction -> SingleColumnAggregateFunction)
-> Ord SingleColumnAggregateFunction
SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Ordering
SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> SingleColumnAggregateFunction
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> SingleColumnAggregateFunction
$cmin :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> SingleColumnAggregateFunction
max :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> SingleColumnAggregateFunction
$cmax :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> SingleColumnAggregateFunction
>= :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
$c>= :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
> :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
$c> :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
<= :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
$c<= :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
< :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
$c< :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Bool
compare :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Ordering
$ccompare :: SingleColumnAggregateFunction
-> SingleColumnAggregateFunction -> Ordering
$cp1Ord :: Eq SingleColumnAggregateFunction
Ord, Int -> SingleColumnAggregateFunction -> ShowS
[SingleColumnAggregateFunction] -> ShowS
SingleColumnAggregateFunction -> String
(Int -> SingleColumnAggregateFunction -> ShowS)
-> (SingleColumnAggregateFunction -> String)
-> ([SingleColumnAggregateFunction] -> ShowS)
-> Show SingleColumnAggregateFunction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SingleColumnAggregateFunction] -> ShowS
$cshowList :: [SingleColumnAggregateFunction] -> ShowS
show :: SingleColumnAggregateFunction -> String
$cshow :: SingleColumnAggregateFunction -> String
showsPrec :: Int -> SingleColumnAggregateFunction -> ShowS
$cshowsPrec :: Int -> SingleColumnAggregateFunction -> ShowS
Show)
  deriving anyclass (Eq SingleColumnAggregateFunction
Eq SingleColumnAggregateFunction
-> (Accesses
    -> SingleColumnAggregateFunction
    -> SingleColumnAggregateFunction
    -> Bool)
-> Cacheable SingleColumnAggregateFunction
Accesses
-> SingleColumnAggregateFunction
-> SingleColumnAggregateFunction
-> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses
-> SingleColumnAggregateFunction
-> SingleColumnAggregateFunction
-> Bool
$cunchanged :: Accesses
-> SingleColumnAggregateFunction
-> SingleColumnAggregateFunction
-> Bool
$cp1Cacheable :: Eq SingleColumnAggregateFunction
Cacheable, Value -> Parser [SingleColumnAggregateFunction]
Value -> Parser SingleColumnAggregateFunction
(Value -> Parser SingleColumnAggregateFunction)
-> (Value -> Parser [SingleColumnAggregateFunction])
-> FromJSON SingleColumnAggregateFunction
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [SingleColumnAggregateFunction]
$cparseJSONList :: Value -> Parser [SingleColumnAggregateFunction]
parseJSON :: Value -> Parser SingleColumnAggregateFunction
$cparseJSON :: Value -> Parser SingleColumnAggregateFunction
FromJSON, Int -> SingleColumnAggregateFunction -> Int
SingleColumnAggregateFunction -> Int
(Int -> SingleColumnAggregateFunction -> Int)
-> (SingleColumnAggregateFunction -> Int)
-> Hashable SingleColumnAggregateFunction
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: SingleColumnAggregateFunction -> Int
$chash :: SingleColumnAggregateFunction -> Int
hashWithSalt :: Int -> SingleColumnAggregateFunction -> Int
$chashWithSalt :: Int -> SingleColumnAggregateFunction -> Int
Hashable, SingleColumnAggregateFunction -> ()
(SingleColumnAggregateFunction -> ())
-> NFData SingleColumnAggregateFunction
forall a. (a -> ()) -> NFData a
rnf :: SingleColumnAggregateFunction -> ()
$crnf :: SingleColumnAggregateFunction -> ()
NFData, [SingleColumnAggregateFunction] -> Value
[SingleColumnAggregateFunction] -> Encoding
SingleColumnAggregateFunction -> Value
SingleColumnAggregateFunction -> Encoding
(SingleColumnAggregateFunction -> Value)
-> (SingleColumnAggregateFunction -> Encoding)
-> ([SingleColumnAggregateFunction] -> Value)
-> ([SingleColumnAggregateFunction] -> Encoding)
-> ToJSON SingleColumnAggregateFunction
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [SingleColumnAggregateFunction] -> Encoding
$ctoEncodingList :: [SingleColumnAggregateFunction] -> Encoding
toJSONList :: [SingleColumnAggregateFunction] -> Value
$ctoJSONList :: [SingleColumnAggregateFunction] -> Value
toEncoding :: SingleColumnAggregateFunction -> Encoding
$ctoEncoding :: SingleColumnAggregateFunction -> Encoding
toJSON :: SingleColumnAggregateFunction -> Value
$ctoJSON :: SingleColumnAggregateFunction -> Value
ToJSON)

instance Witch.From API.SingleColumnAggregateFunction SingleColumnAggregateFunction where
  from :: SingleColumnAggregateFunction -> SingleColumnAggregateFunction
from SingleColumnAggregateFunction
API.Average = SingleColumnAggregateFunction
Average
  from SingleColumnAggregateFunction
API.Max = SingleColumnAggregateFunction
Max
  from SingleColumnAggregateFunction
API.Min = SingleColumnAggregateFunction
Min
  from SingleColumnAggregateFunction
API.StandardDeviationPopulation = SingleColumnAggregateFunction
StandardDeviationPopulation
  from SingleColumnAggregateFunction
API.StandardDeviationSample = SingleColumnAggregateFunction
StandardDeviationSample
  from SingleColumnAggregateFunction
API.Sum = SingleColumnAggregateFunction
Sum
  from SingleColumnAggregateFunction
API.VariancePopulation = SingleColumnAggregateFunction
VariancePopulation
  from SingleColumnAggregateFunction
API.VarianceSample = SingleColumnAggregateFunction
VarianceSample

instance Witch.From SingleColumnAggregateFunction API.SingleColumnAggregateFunction where
  from :: SingleColumnAggregateFunction -> SingleColumnAggregateFunction
from SingleColumnAggregateFunction
Average = SingleColumnAggregateFunction
API.Average
  from SingleColumnAggregateFunction
Max = SingleColumnAggregateFunction
API.Max
  from SingleColumnAggregateFunction
Min = SingleColumnAggregateFunction
API.Min
  from SingleColumnAggregateFunction
StandardDeviationPopulation = SingleColumnAggregateFunction
API.StandardDeviationPopulation
  from SingleColumnAggregateFunction
StandardDeviationSample = SingleColumnAggregateFunction
API.StandardDeviationSample
  from SingleColumnAggregateFunction
Sum = SingleColumnAggregateFunction
API.Sum
  from SingleColumnAggregateFunction
VariancePopulation = SingleColumnAggregateFunction
API.VariancePopulation
  from SingleColumnAggregateFunction
VarianceSample = SingleColumnAggregateFunction
API.VarianceSample

data CountAggregate
  = StarCount
  | ColumnCount IR.C.Name
  | ColumnDistinctCount IR.C.Name
  deriving stock (Typeable CountAggregate
DataType
Constr
Typeable CountAggregate
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> CountAggregate -> c CountAggregate)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CountAggregate)
-> (CountAggregate -> Constr)
-> (CountAggregate -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CountAggregate))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c CountAggregate))
-> ((forall b. Data b => b -> b)
    -> CountAggregate -> CountAggregate)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CountAggregate -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CountAggregate -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> CountAggregate -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CountAggregate -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> CountAggregate -> m CountAggregate)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> CountAggregate -> m CountAggregate)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> CountAggregate -> m CountAggregate)
-> Data CountAggregate
CountAggregate -> DataType
CountAggregate -> Constr
(forall b. Data b => b -> b) -> CountAggregate -> CountAggregate
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CountAggregate -> c CountAggregate
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CountAggregate
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> CountAggregate -> u
forall u. (forall d. Data d => d -> u) -> CountAggregate -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CountAggregate -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CountAggregate -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CountAggregate -> m CountAggregate
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CountAggregate -> m CountAggregate
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CountAggregate
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CountAggregate -> c CountAggregate
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CountAggregate)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CountAggregate)
$cColumnDistinctCount :: Constr
$cColumnCount :: Constr
$cStarCount :: Constr
$tCountAggregate :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> CountAggregate -> m CountAggregate
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CountAggregate -> m CountAggregate
gmapMp :: (forall d. Data d => d -> m d)
-> CountAggregate -> m CountAggregate
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> CountAggregate -> m CountAggregate
gmapM :: (forall d. Data d => d -> m d)
-> CountAggregate -> m CountAggregate
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> CountAggregate -> m CountAggregate
gmapQi :: Int -> (forall d. Data d => d -> u) -> CountAggregate -> u
$cgmapQi :: forall u.
Int -> (forall d. Data d => d -> u) -> CountAggregate -> u
gmapQ :: (forall d. Data d => d -> u) -> CountAggregate -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CountAggregate -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CountAggregate -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CountAggregate -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CountAggregate -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CountAggregate -> r
gmapT :: (forall b. Data b => b -> b) -> CountAggregate -> CountAggregate
$cgmapT :: (forall b. Data b => b -> b) -> CountAggregate -> CountAggregate
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CountAggregate)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c CountAggregate)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CountAggregate)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CountAggregate)
dataTypeOf :: CountAggregate -> DataType
$cdataTypeOf :: CountAggregate -> DataType
toConstr :: CountAggregate -> Constr
$ctoConstr :: CountAggregate -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CountAggregate
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CountAggregate
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CountAggregate -> c CountAggregate
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CountAggregate -> c CountAggregate
$cp1Data :: Typeable CountAggregate
Data, CountAggregate -> CountAggregate -> Bool
(CountAggregate -> CountAggregate -> Bool)
-> (CountAggregate -> CountAggregate -> Bool) -> Eq CountAggregate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CountAggregate -> CountAggregate -> Bool
$c/= :: CountAggregate -> CountAggregate -> Bool
== :: CountAggregate -> CountAggregate -> Bool
$c== :: CountAggregate -> CountAggregate -> Bool
Eq, (forall x. CountAggregate -> Rep CountAggregate x)
-> (forall x. Rep CountAggregate x -> CountAggregate)
-> Generic CountAggregate
forall x. Rep CountAggregate x -> CountAggregate
forall x. CountAggregate -> Rep CountAggregate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CountAggregate x -> CountAggregate
$cfrom :: forall x. CountAggregate -> Rep CountAggregate x
Generic, Eq CountAggregate
Eq CountAggregate
-> (CountAggregate -> CountAggregate -> Ordering)
-> (CountAggregate -> CountAggregate -> Bool)
-> (CountAggregate -> CountAggregate -> Bool)
-> (CountAggregate -> CountAggregate -> Bool)
-> (CountAggregate -> CountAggregate -> Bool)
-> (CountAggregate -> CountAggregate -> CountAggregate)
-> (CountAggregate -> CountAggregate -> CountAggregate)
-> Ord CountAggregate
CountAggregate -> CountAggregate -> Bool
CountAggregate -> CountAggregate -> Ordering
CountAggregate -> CountAggregate -> CountAggregate
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: CountAggregate -> CountAggregate -> CountAggregate
$cmin :: CountAggregate -> CountAggregate -> CountAggregate
max :: CountAggregate -> CountAggregate -> CountAggregate
$cmax :: CountAggregate -> CountAggregate -> CountAggregate
>= :: CountAggregate -> CountAggregate -> Bool
$c>= :: CountAggregate -> CountAggregate -> Bool
> :: CountAggregate -> CountAggregate -> Bool
$c> :: CountAggregate -> CountAggregate -> Bool
<= :: CountAggregate -> CountAggregate -> Bool
$c<= :: CountAggregate -> CountAggregate -> Bool
< :: CountAggregate -> CountAggregate -> Bool
$c< :: CountAggregate -> CountAggregate -> Bool
compare :: CountAggregate -> CountAggregate -> Ordering
$ccompare :: CountAggregate -> CountAggregate -> Ordering
$cp1Ord :: Eq CountAggregate
Ord, Int -> CountAggregate -> ShowS
[CountAggregate] -> ShowS
CountAggregate -> String
(Int -> CountAggregate -> ShowS)
-> (CountAggregate -> String)
-> ([CountAggregate] -> ShowS)
-> Show CountAggregate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CountAggregate] -> ShowS
$cshowList :: [CountAggregate] -> ShowS
show :: CountAggregate -> String
$cshow :: CountAggregate -> String
showsPrec :: Int -> CountAggregate -> ShowS
$cshowsPrec :: Int -> CountAggregate -> ShowS
Show)
  deriving anyclass (Eq CountAggregate
Eq CountAggregate
-> (Accesses -> CountAggregate -> CountAggregate -> Bool)
-> Cacheable CountAggregate
Accesses -> CountAggregate -> CountAggregate -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> CountAggregate -> CountAggregate -> Bool
$cunchanged :: Accesses -> CountAggregate -> CountAggregate -> Bool
$cp1Cacheable :: Eq CountAggregate
Cacheable, Value -> Parser [CountAggregate]
Value -> Parser CountAggregate
(Value -> Parser CountAggregate)
-> (Value -> Parser [CountAggregate]) -> FromJSON CountAggregate
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
parseJSONList :: Value -> Parser [CountAggregate]
$cparseJSONList :: Value -> Parser [CountAggregate]
parseJSON :: Value -> Parser CountAggregate
$cparseJSON :: Value -> Parser CountAggregate
FromJSON, Int -> CountAggregate -> Int
CountAggregate -> Int
(Int -> CountAggregate -> Int)
-> (CountAggregate -> Int) -> Hashable CountAggregate
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: CountAggregate -> Int
$chash :: CountAggregate -> Int
hashWithSalt :: Int -> CountAggregate -> Int
$chashWithSalt :: Int -> CountAggregate -> Int
Hashable, CountAggregate -> ()
(CountAggregate -> ()) -> NFData CountAggregate
forall a. (a -> ()) -> NFData a
rnf :: CountAggregate -> ()
$crnf :: CountAggregate -> ()
NFData, [CountAggregate] -> Value
[CountAggregate] -> Encoding
CountAggregate -> Value
CountAggregate -> Encoding
(CountAggregate -> Value)
-> (CountAggregate -> Encoding)
-> ([CountAggregate] -> Value)
-> ([CountAggregate] -> Encoding)
-> ToJSON CountAggregate
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
toEncodingList :: [CountAggregate] -> Encoding
$ctoEncodingList :: [CountAggregate] -> Encoding
toJSONList :: [CountAggregate] -> Value
$ctoJSONList :: [CountAggregate] -> Value
toEncoding :: CountAggregate -> Encoding
$ctoEncoding :: CountAggregate -> Encoding
toJSON :: CountAggregate -> Value
$ctoJSON :: CountAggregate -> Value
ToJSON)