{-# LANGUAGE TemplateHaskell #-}
module Hasura.Backends.Postgres.Types.ComputedField
( ComputedFieldDefinition (..),
FunctionTableArgument (..),
FunctionSessionArgument (..),
ComputedFieldImplicitArguments (..),
fromComputedFieldImplicitArguments,
ComputedFieldReturn (..),
_CFRScalar,
_CFRSetofTable,
)
where
import Autodocodec (HasCodec, optionalField', requiredField')
import Autodocodec qualified as AC
import Control.Lens.TH (makePrisms)
import Data.Aeson.Casing
import Data.Aeson.Extended
import Hasura.Backends.Postgres.SQL.Types
import Hasura.Backends.Postgres.Types.Function
import Hasura.Function.Cache
import Hasura.Prelude
data ComputedFieldDefinition = ComputedFieldDefinition
{ ComputedFieldDefinition -> QualifiedFunction
_cfdFunction :: QualifiedFunction,
ComputedFieldDefinition -> Maybe FunctionArgName
_cfdTableArgument :: Maybe FunctionArgName,
ComputedFieldDefinition -> Maybe FunctionArgName
_cfdSessionArgument :: Maybe FunctionArgName
}
deriving (Int -> ComputedFieldDefinition -> ShowS
[ComputedFieldDefinition] -> ShowS
ComputedFieldDefinition -> String
(Int -> ComputedFieldDefinition -> ShowS)
-> (ComputedFieldDefinition -> String)
-> ([ComputedFieldDefinition] -> ShowS)
-> Show ComputedFieldDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ComputedFieldDefinition -> ShowS
showsPrec :: Int -> ComputedFieldDefinition -> ShowS
$cshow :: ComputedFieldDefinition -> String
show :: ComputedFieldDefinition -> String
$cshowList :: [ComputedFieldDefinition] -> ShowS
showList :: [ComputedFieldDefinition] -> ShowS
Show, ComputedFieldDefinition -> ComputedFieldDefinition -> Bool
(ComputedFieldDefinition -> ComputedFieldDefinition -> Bool)
-> (ComputedFieldDefinition -> ComputedFieldDefinition -> Bool)
-> Eq ComputedFieldDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ComputedFieldDefinition -> ComputedFieldDefinition -> Bool
== :: ComputedFieldDefinition -> ComputedFieldDefinition -> Bool
$c/= :: ComputedFieldDefinition -> ComputedFieldDefinition -> Bool
/= :: ComputedFieldDefinition -> ComputedFieldDefinition -> Bool
Eq, (forall x.
ComputedFieldDefinition -> Rep ComputedFieldDefinition x)
-> (forall x.
Rep ComputedFieldDefinition x -> ComputedFieldDefinition)
-> Generic ComputedFieldDefinition
forall x. Rep ComputedFieldDefinition x -> ComputedFieldDefinition
forall x. ComputedFieldDefinition -> Rep ComputedFieldDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ComputedFieldDefinition -> Rep ComputedFieldDefinition x
from :: forall x. ComputedFieldDefinition -> Rep ComputedFieldDefinition x
$cto :: forall x. Rep ComputedFieldDefinition x -> ComputedFieldDefinition
to :: forall x. Rep ComputedFieldDefinition x -> ComputedFieldDefinition
Generic)
instance NFData ComputedFieldDefinition
instance Hashable ComputedFieldDefinition
instance HasCodec ComputedFieldDefinition where
codec :: JSONCodec ComputedFieldDefinition
codec =
Text
-> ObjectCodec ComputedFieldDefinition ComputedFieldDefinition
-> JSONCodec ComputedFieldDefinition
forall input output.
Text -> ObjectCodec input output -> ValueCodec input output
AC.object Text
"PostgresComputedFieldDefinition"
(ObjectCodec ComputedFieldDefinition ComputedFieldDefinition
-> JSONCodec ComputedFieldDefinition)
-> ObjectCodec ComputedFieldDefinition ComputedFieldDefinition
-> JSONCodec ComputedFieldDefinition
forall a b. (a -> b) -> a -> b
$ QualifiedFunction
-> Maybe FunctionArgName
-> Maybe FunctionArgName
-> ComputedFieldDefinition
ComputedFieldDefinition
(QualifiedFunction
-> Maybe FunctionArgName
-> Maybe FunctionArgName
-> ComputedFieldDefinition)
-> Codec Object ComputedFieldDefinition QualifiedFunction
-> Codec
Object
ComputedFieldDefinition
(Maybe FunctionArgName
-> Maybe FunctionArgName -> ComputedFieldDefinition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> ObjectCodec QualifiedFunction QualifiedFunction
forall output. HasCodec output => Text -> ObjectCodec output output
requiredField' Text
"function"
ObjectCodec QualifiedFunction QualifiedFunction
-> (ComputedFieldDefinition -> QualifiedFunction)
-> Codec Object ComputedFieldDefinition QualifiedFunction
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
AC..= ComputedFieldDefinition -> QualifiedFunction
_cfdFunction
Codec
Object
ComputedFieldDefinition
(Maybe FunctionArgName
-> Maybe FunctionArgName -> ComputedFieldDefinition)
-> Codec Object ComputedFieldDefinition (Maybe FunctionArgName)
-> Codec
Object
ComputedFieldDefinition
(Maybe FunctionArgName -> ComputedFieldDefinition)
forall a b.
Codec Object ComputedFieldDefinition (a -> b)
-> Codec Object ComputedFieldDefinition a
-> Codec Object ComputedFieldDefinition b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text -> ObjectCodec (Maybe FunctionArgName) (Maybe FunctionArgName)
forall output.
HasCodec output =>
Text -> ObjectCodec (Maybe output) (Maybe output)
optionalField' Text
"table_argument"
ObjectCodec (Maybe FunctionArgName) (Maybe FunctionArgName)
-> (ComputedFieldDefinition -> Maybe FunctionArgName)
-> Codec Object ComputedFieldDefinition (Maybe FunctionArgName)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
AC..= ComputedFieldDefinition -> Maybe FunctionArgName
_cfdTableArgument
Codec
Object
ComputedFieldDefinition
(Maybe FunctionArgName -> ComputedFieldDefinition)
-> Codec Object ComputedFieldDefinition (Maybe FunctionArgName)
-> ObjectCodec ComputedFieldDefinition ComputedFieldDefinition
forall a b.
Codec Object ComputedFieldDefinition (a -> b)
-> Codec Object ComputedFieldDefinition a
-> Codec Object ComputedFieldDefinition b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text -> ObjectCodec (Maybe FunctionArgName) (Maybe FunctionArgName)
forall output.
HasCodec output =>
Text -> ObjectCodec (Maybe output) (Maybe output)
optionalField' Text
"session_argument"
ObjectCodec (Maybe FunctionArgName) (Maybe FunctionArgName)
-> (ComputedFieldDefinition -> Maybe FunctionArgName)
-> Codec Object ComputedFieldDefinition (Maybe FunctionArgName)
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
AC..= ComputedFieldDefinition -> Maybe FunctionArgName
_cfdSessionArgument
instance ToJSON ComputedFieldDefinition where
toJSON :: ComputedFieldDefinition -> Value
toJSON = Options -> ComputedFieldDefinition -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
hasuraJSON {omitNothingFields :: Bool
omitNothingFields = Bool
True}
instance FromJSON ComputedFieldDefinition where
parseJSON :: Value -> Parser ComputedFieldDefinition
parseJSON = Options -> Value -> Parser ComputedFieldDefinition
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
hasuraJSON {omitNothingFields :: Bool
omitNothingFields = Bool
True}
data FunctionTableArgument
= FTAFirst
| FTANamed
FunctionArgName
Int
deriving (Int -> FunctionTableArgument -> ShowS
[FunctionTableArgument] -> ShowS
FunctionTableArgument -> String
(Int -> FunctionTableArgument -> ShowS)
-> (FunctionTableArgument -> String)
-> ([FunctionTableArgument] -> ShowS)
-> Show FunctionTableArgument
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FunctionTableArgument -> ShowS
showsPrec :: Int -> FunctionTableArgument -> ShowS
$cshow :: FunctionTableArgument -> String
show :: FunctionTableArgument -> String
$cshowList :: [FunctionTableArgument] -> ShowS
showList :: [FunctionTableArgument] -> ShowS
Show, FunctionTableArgument -> FunctionTableArgument -> Bool
(FunctionTableArgument -> FunctionTableArgument -> Bool)
-> (FunctionTableArgument -> FunctionTableArgument -> Bool)
-> Eq FunctionTableArgument
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FunctionTableArgument -> FunctionTableArgument -> Bool
== :: FunctionTableArgument -> FunctionTableArgument -> Bool
$c/= :: FunctionTableArgument -> FunctionTableArgument -> Bool
/= :: FunctionTableArgument -> FunctionTableArgument -> Bool
Eq, Eq FunctionTableArgument
Eq FunctionTableArgument
-> (FunctionTableArgument -> FunctionTableArgument -> Ordering)
-> (FunctionTableArgument -> FunctionTableArgument -> Bool)
-> (FunctionTableArgument -> FunctionTableArgument -> Bool)
-> (FunctionTableArgument -> FunctionTableArgument -> Bool)
-> (FunctionTableArgument -> FunctionTableArgument -> Bool)
-> (FunctionTableArgument
-> FunctionTableArgument -> FunctionTableArgument)
-> (FunctionTableArgument
-> FunctionTableArgument -> FunctionTableArgument)
-> Ord FunctionTableArgument
FunctionTableArgument -> FunctionTableArgument -> Bool
FunctionTableArgument -> FunctionTableArgument -> Ordering
FunctionTableArgument
-> FunctionTableArgument -> FunctionTableArgument
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
$ccompare :: FunctionTableArgument -> FunctionTableArgument -> Ordering
compare :: FunctionTableArgument -> FunctionTableArgument -> Ordering
$c< :: FunctionTableArgument -> FunctionTableArgument -> Bool
< :: FunctionTableArgument -> FunctionTableArgument -> Bool
$c<= :: FunctionTableArgument -> FunctionTableArgument -> Bool
<= :: FunctionTableArgument -> FunctionTableArgument -> Bool
$c> :: FunctionTableArgument -> FunctionTableArgument -> Bool
> :: FunctionTableArgument -> FunctionTableArgument -> Bool
$c>= :: FunctionTableArgument -> FunctionTableArgument -> Bool
>= :: FunctionTableArgument -> FunctionTableArgument -> Bool
$cmax :: FunctionTableArgument
-> FunctionTableArgument -> FunctionTableArgument
max :: FunctionTableArgument
-> FunctionTableArgument -> FunctionTableArgument
$cmin :: FunctionTableArgument
-> FunctionTableArgument -> FunctionTableArgument
min :: FunctionTableArgument
-> FunctionTableArgument -> FunctionTableArgument
Ord, (forall x. FunctionTableArgument -> Rep FunctionTableArgument x)
-> (forall x. Rep FunctionTableArgument x -> FunctionTableArgument)
-> Generic FunctionTableArgument
forall x. Rep FunctionTableArgument x -> FunctionTableArgument
forall x. FunctionTableArgument -> Rep FunctionTableArgument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FunctionTableArgument -> Rep FunctionTableArgument x
from :: forall x. FunctionTableArgument -> Rep FunctionTableArgument x
$cto :: forall x. Rep FunctionTableArgument x -> FunctionTableArgument
to :: forall x. Rep FunctionTableArgument x -> FunctionTableArgument
Generic)
instance NFData FunctionTableArgument
instance Hashable FunctionTableArgument
instance ToJSON FunctionTableArgument where
toJSON :: FunctionTableArgument -> Value
toJSON FunctionTableArgument
FTAFirst = Text -> Value
String Text
"first_argument"
toJSON (FTANamed FunctionArgName
argName Int
_) = [Pair] -> Value
object [Key
"name" Key -> FunctionArgName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
.= FunctionArgName
argName]
data FunctionSessionArgument
= FunctionSessionArgument
FunctionArgName
Int
deriving (Int -> FunctionSessionArgument -> ShowS
[FunctionSessionArgument] -> ShowS
FunctionSessionArgument -> String
(Int -> FunctionSessionArgument -> ShowS)
-> (FunctionSessionArgument -> String)
-> ([FunctionSessionArgument] -> ShowS)
-> Show FunctionSessionArgument
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FunctionSessionArgument -> ShowS
showsPrec :: Int -> FunctionSessionArgument -> ShowS
$cshow :: FunctionSessionArgument -> String
show :: FunctionSessionArgument -> String
$cshowList :: [FunctionSessionArgument] -> ShowS
showList :: [FunctionSessionArgument] -> ShowS
Show, FunctionSessionArgument -> FunctionSessionArgument -> Bool
(FunctionSessionArgument -> FunctionSessionArgument -> Bool)
-> (FunctionSessionArgument -> FunctionSessionArgument -> Bool)
-> Eq FunctionSessionArgument
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
== :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
$c/= :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
/= :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
Eq, Eq FunctionSessionArgument
Eq FunctionSessionArgument
-> (FunctionSessionArgument -> FunctionSessionArgument -> Ordering)
-> (FunctionSessionArgument -> FunctionSessionArgument -> Bool)
-> (FunctionSessionArgument -> FunctionSessionArgument -> Bool)
-> (FunctionSessionArgument -> FunctionSessionArgument -> Bool)
-> (FunctionSessionArgument -> FunctionSessionArgument -> Bool)
-> (FunctionSessionArgument
-> FunctionSessionArgument -> FunctionSessionArgument)
-> (FunctionSessionArgument
-> FunctionSessionArgument -> FunctionSessionArgument)
-> Ord FunctionSessionArgument
FunctionSessionArgument -> FunctionSessionArgument -> Bool
FunctionSessionArgument -> FunctionSessionArgument -> Ordering
FunctionSessionArgument
-> FunctionSessionArgument -> FunctionSessionArgument
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
$ccompare :: FunctionSessionArgument -> FunctionSessionArgument -> Ordering
compare :: FunctionSessionArgument -> FunctionSessionArgument -> Ordering
$c< :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
< :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
$c<= :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
<= :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
$c> :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
> :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
$c>= :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
>= :: FunctionSessionArgument -> FunctionSessionArgument -> Bool
$cmax :: FunctionSessionArgument
-> FunctionSessionArgument -> FunctionSessionArgument
max :: FunctionSessionArgument
-> FunctionSessionArgument -> FunctionSessionArgument
$cmin :: FunctionSessionArgument
-> FunctionSessionArgument -> FunctionSessionArgument
min :: FunctionSessionArgument
-> FunctionSessionArgument -> FunctionSessionArgument
Ord, (forall x.
FunctionSessionArgument -> Rep FunctionSessionArgument x)
-> (forall x.
Rep FunctionSessionArgument x -> FunctionSessionArgument)
-> Generic FunctionSessionArgument
forall x. Rep FunctionSessionArgument x -> FunctionSessionArgument
forall x. FunctionSessionArgument -> Rep FunctionSessionArgument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FunctionSessionArgument -> Rep FunctionSessionArgument x
from :: forall x. FunctionSessionArgument -> Rep FunctionSessionArgument x
$cto :: forall x. Rep FunctionSessionArgument x -> FunctionSessionArgument
to :: forall x. Rep FunctionSessionArgument x -> FunctionSessionArgument
Generic)
instance NFData FunctionSessionArgument
instance Hashable FunctionSessionArgument
instance ToJSON FunctionSessionArgument where
toJSON :: FunctionSessionArgument -> Value
toJSON (FunctionSessionArgument FunctionArgName
argName Int
_) = FunctionArgName -> Value
forall a. ToJSON a => a -> Value
toJSON FunctionArgName
argName
data ComputedFieldImplicitArguments = ComputedFieldImplicitArguments
{ ComputedFieldImplicitArguments -> FunctionTableArgument
_cffaTableArgument :: FunctionTableArgument,
ComputedFieldImplicitArguments -> Maybe FunctionSessionArgument
_cffaSessionArgument :: Maybe FunctionSessionArgument
}
deriving stock (Int -> ComputedFieldImplicitArguments -> ShowS
[ComputedFieldImplicitArguments] -> ShowS
ComputedFieldImplicitArguments -> String
(Int -> ComputedFieldImplicitArguments -> ShowS)
-> (ComputedFieldImplicitArguments -> String)
-> ([ComputedFieldImplicitArguments] -> ShowS)
-> Show ComputedFieldImplicitArguments
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ComputedFieldImplicitArguments -> ShowS
showsPrec :: Int -> ComputedFieldImplicitArguments -> ShowS
$cshow :: ComputedFieldImplicitArguments -> String
show :: ComputedFieldImplicitArguments -> String
$cshowList :: [ComputedFieldImplicitArguments] -> ShowS
showList :: [ComputedFieldImplicitArguments] -> ShowS
Show, ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
(ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool)
-> (ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool)
-> Eq ComputedFieldImplicitArguments
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
== :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
$c/= :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
/= :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
Eq, Eq ComputedFieldImplicitArguments
Eq ComputedFieldImplicitArguments
-> (ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Ordering)
-> (ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool)
-> (ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool)
-> (ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool)
-> (ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool)
-> (ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments)
-> (ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments)
-> Ord ComputedFieldImplicitArguments
ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Ordering
ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> ComputedFieldImplicitArguments
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
$ccompare :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Ordering
compare :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Ordering
$c< :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
< :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
$c<= :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
<= :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
$c> :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
> :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
$c>= :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
>= :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> Bool
$cmax :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> ComputedFieldImplicitArguments
max :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> ComputedFieldImplicitArguments
$cmin :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> ComputedFieldImplicitArguments
min :: ComputedFieldImplicitArguments
-> ComputedFieldImplicitArguments -> ComputedFieldImplicitArguments
Ord, (forall x.
ComputedFieldImplicitArguments
-> Rep ComputedFieldImplicitArguments x)
-> (forall x.
Rep ComputedFieldImplicitArguments x
-> ComputedFieldImplicitArguments)
-> Generic ComputedFieldImplicitArguments
forall x.
Rep ComputedFieldImplicitArguments x
-> ComputedFieldImplicitArguments
forall x.
ComputedFieldImplicitArguments
-> Rep ComputedFieldImplicitArguments x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
ComputedFieldImplicitArguments
-> Rep ComputedFieldImplicitArguments x
from :: forall x.
ComputedFieldImplicitArguments
-> Rep ComputedFieldImplicitArguments x
$cto :: forall x.
Rep ComputedFieldImplicitArguments x
-> ComputedFieldImplicitArguments
to :: forall x.
Rep ComputedFieldImplicitArguments x
-> ComputedFieldImplicitArguments
Generic)
instance NFData ComputedFieldImplicitArguments
instance Hashable ComputedFieldImplicitArguments
instance ToJSON ComputedFieldImplicitArguments where
toJSON :: ComputedFieldImplicitArguments -> Value
toJSON = Options -> ComputedFieldImplicitArguments -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
hasuraJSON
fromComputedFieldImplicitArguments ::
v ->
ComputedFieldImplicitArguments ->
[ArgumentExp v]
fromComputedFieldImplicitArguments :: forall v. v -> ComputedFieldImplicitArguments -> [ArgumentExp v]
fromComputedFieldImplicitArguments v
_ (ComputedFieldImplicitArguments FunctionTableArgument
_ Maybe FunctionSessionArgument
Nothing) = [ArgumentExp v
forall a. ArgumentExp a
AETableRow]
fromComputedFieldImplicitArguments v
sess (ComputedFieldImplicitArguments FunctionTableArgument
FTAFirst Maybe FunctionSessionArgument
_) = [ArgumentExp v
forall a. ArgumentExp a
AETableRow, v -> ArgumentExp v
forall a. a -> ArgumentExp a
AESession v
sess]
fromComputedFieldImplicitArguments v
sess (ComputedFieldImplicitArguments (FTANamed FunctionArgName
_ Int
0) Maybe FunctionSessionArgument
_) = [ArgumentExp v
forall a. ArgumentExp a
AETableRow, v -> ArgumentExp v
forall a. a -> ArgumentExp a
AESession v
sess]
fromComputedFieldImplicitArguments v
sess ComputedFieldImplicitArguments
_ = [v -> ArgumentExp v
forall a. a -> ArgumentExp a
AESession v
sess, ArgumentExp v
forall a. ArgumentExp a
AETableRow]
data ComputedFieldReturn
= CFRScalar PGScalarType
| CFRSetofTable QualifiedTable
deriving (Int -> ComputedFieldReturn -> ShowS
[ComputedFieldReturn] -> ShowS
ComputedFieldReturn -> String
(Int -> ComputedFieldReturn -> ShowS)
-> (ComputedFieldReturn -> String)
-> ([ComputedFieldReturn] -> ShowS)
-> Show ComputedFieldReturn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ComputedFieldReturn -> ShowS
showsPrec :: Int -> ComputedFieldReturn -> ShowS
$cshow :: ComputedFieldReturn -> String
show :: ComputedFieldReturn -> String
$cshowList :: [ComputedFieldReturn] -> ShowS
showList :: [ComputedFieldReturn] -> ShowS
Show, ComputedFieldReturn -> ComputedFieldReturn -> Bool
(ComputedFieldReturn -> ComputedFieldReturn -> Bool)
-> (ComputedFieldReturn -> ComputedFieldReturn -> Bool)
-> Eq ComputedFieldReturn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
== :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
$c/= :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
/= :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
Eq, Eq ComputedFieldReturn
Eq ComputedFieldReturn
-> (ComputedFieldReturn -> ComputedFieldReturn -> Ordering)
-> (ComputedFieldReturn -> ComputedFieldReturn -> Bool)
-> (ComputedFieldReturn -> ComputedFieldReturn -> Bool)
-> (ComputedFieldReturn -> ComputedFieldReturn -> Bool)
-> (ComputedFieldReturn -> ComputedFieldReturn -> Bool)
-> (ComputedFieldReturn
-> ComputedFieldReturn -> ComputedFieldReturn)
-> (ComputedFieldReturn
-> ComputedFieldReturn -> ComputedFieldReturn)
-> Ord ComputedFieldReturn
ComputedFieldReturn -> ComputedFieldReturn -> Bool
ComputedFieldReturn -> ComputedFieldReturn -> Ordering
ComputedFieldReturn -> ComputedFieldReturn -> ComputedFieldReturn
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
$ccompare :: ComputedFieldReturn -> ComputedFieldReturn -> Ordering
compare :: ComputedFieldReturn -> ComputedFieldReturn -> Ordering
$c< :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
< :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
$c<= :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
<= :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
$c> :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
> :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
$c>= :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
>= :: ComputedFieldReturn -> ComputedFieldReturn -> Bool
$cmax :: ComputedFieldReturn -> ComputedFieldReturn -> ComputedFieldReturn
max :: ComputedFieldReturn -> ComputedFieldReturn -> ComputedFieldReturn
$cmin :: ComputedFieldReturn -> ComputedFieldReturn -> ComputedFieldReturn
min :: ComputedFieldReturn -> ComputedFieldReturn -> ComputedFieldReturn
Ord, (forall x. ComputedFieldReturn -> Rep ComputedFieldReturn x)
-> (forall x. Rep ComputedFieldReturn x -> ComputedFieldReturn)
-> Generic ComputedFieldReturn
forall x. Rep ComputedFieldReturn x -> ComputedFieldReturn
forall x. ComputedFieldReturn -> Rep ComputedFieldReturn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ComputedFieldReturn -> Rep ComputedFieldReturn x
from :: forall x. ComputedFieldReturn -> Rep ComputedFieldReturn x
$cto :: forall x. Rep ComputedFieldReturn x -> ComputedFieldReturn
to :: forall x. Rep ComputedFieldReturn x -> ComputedFieldReturn
Generic)
instance NFData ComputedFieldReturn
instance Hashable ComputedFieldReturn
instance ToJSON ComputedFieldReturn where
toJSON :: ComputedFieldReturn -> Value
toJSON =
Options -> ComputedFieldReturn -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON
(Options -> ComputedFieldReturn -> Value)
-> Options -> ComputedFieldReturn -> Value
forall a b. (a -> b) -> a -> b
$ Options
defaultOptions
{ constructorTagModifier :: ShowS
constructorTagModifier = ShowS
snakeCase ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ShowS
forall a. Int -> [a] -> [a]
drop Int
3,
sumEncoding :: SumEncoding
sumEncoding = String -> String -> SumEncoding
TaggedObject String
"type" String
"info"
}
$(makePrisms ''ComputedFieldReturn)