module Hasura.Backends.Postgres.Types.Function
( ArgumentExp (..),
onArgumentExp,
actionResponsePayloadColumn,
FunctionArg (..),
HasDefault (..),
)
where
import Data.Aeson
import Hasura.Backends.Postgres.SQL.Types
import Hasura.Function.Cache
import Hasura.Prelude
newtype HasDefault = HasDefault {HasDefault -> Bool
unHasDefault :: Bool}
deriving (Int -> HasDefault -> ShowS
[HasDefault] -> ShowS
HasDefault -> String
(Int -> HasDefault -> ShowS)
-> (HasDefault -> String)
-> ([HasDefault] -> ShowS)
-> Show HasDefault
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HasDefault -> ShowS
showsPrec :: Int -> HasDefault -> ShowS
$cshow :: HasDefault -> String
show :: HasDefault -> String
$cshowList :: [HasDefault] -> ShowS
showList :: [HasDefault] -> ShowS
Show, HasDefault -> HasDefault -> Bool
(HasDefault -> HasDefault -> Bool)
-> (HasDefault -> HasDefault -> Bool) -> Eq HasDefault
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HasDefault -> HasDefault -> Bool
== :: HasDefault -> HasDefault -> Bool
$c/= :: HasDefault -> HasDefault -> Bool
/= :: HasDefault -> HasDefault -> Bool
Eq, Eq HasDefault
Eq HasDefault
-> (HasDefault -> HasDefault -> Ordering)
-> (HasDefault -> HasDefault -> Bool)
-> (HasDefault -> HasDefault -> Bool)
-> (HasDefault -> HasDefault -> Bool)
-> (HasDefault -> HasDefault -> Bool)
-> (HasDefault -> HasDefault -> HasDefault)
-> (HasDefault -> HasDefault -> HasDefault)
-> Ord HasDefault
HasDefault -> HasDefault -> Bool
HasDefault -> HasDefault -> Ordering
HasDefault -> HasDefault -> HasDefault
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 :: HasDefault -> HasDefault -> Ordering
compare :: HasDefault -> HasDefault -> Ordering
$c< :: HasDefault -> HasDefault -> Bool
< :: HasDefault -> HasDefault -> Bool
$c<= :: HasDefault -> HasDefault -> Bool
<= :: HasDefault -> HasDefault -> Bool
$c> :: HasDefault -> HasDefault -> Bool
> :: HasDefault -> HasDefault -> Bool
$c>= :: HasDefault -> HasDefault -> Bool
>= :: HasDefault -> HasDefault -> Bool
$cmax :: HasDefault -> HasDefault -> HasDefault
max :: HasDefault -> HasDefault -> HasDefault
$cmin :: HasDefault -> HasDefault -> HasDefault
min :: HasDefault -> HasDefault -> HasDefault
Ord, (forall x. HasDefault -> Rep HasDefault x)
-> (forall x. Rep HasDefault x -> HasDefault) -> Generic HasDefault
forall x. Rep HasDefault x -> HasDefault
forall x. HasDefault -> Rep HasDefault x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HasDefault -> Rep HasDefault x
from :: forall x. HasDefault -> Rep HasDefault x
$cto :: forall x. Rep HasDefault x -> HasDefault
to :: forall x. Rep HasDefault x -> HasDefault
Generic, [HasDefault] -> Value
[HasDefault] -> Encoding
HasDefault -> Value
HasDefault -> Encoding
(HasDefault -> Value)
-> (HasDefault -> Encoding)
-> ([HasDefault] -> Value)
-> ([HasDefault] -> Encoding)
-> ToJSON HasDefault
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: HasDefault -> Value
toJSON :: HasDefault -> Value
$ctoEncoding :: HasDefault -> Encoding
toEncoding :: HasDefault -> Encoding
$ctoJSONList :: [HasDefault] -> Value
toJSONList :: [HasDefault] -> Value
$ctoEncodingList :: [HasDefault] -> Encoding
toEncodingList :: [HasDefault] -> Encoding
ToJSON, HasDefault -> ()
(HasDefault -> ()) -> NFData HasDefault
forall a. (a -> ()) -> NFData a
$crnf :: HasDefault -> ()
rnf :: HasDefault -> ()
NFData, Eq HasDefault
Eq HasDefault
-> (Int -> HasDefault -> Int)
-> (HasDefault -> Int)
-> Hashable HasDefault
Int -> HasDefault -> Int
HasDefault -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> HasDefault -> Int
hashWithSalt :: Int -> HasDefault -> Int
$chash :: HasDefault -> Int
hash :: HasDefault -> Int
Hashable)
data FunctionArg = FunctionArg
{ FunctionArg -> Maybe FunctionArgName
faName :: Maybe FunctionArgName,
FunctionArg -> QualifiedPGType
faType :: QualifiedPGType,
FunctionArg -> HasDefault
faHasDefault :: HasDefault
}
deriving (Int -> FunctionArg -> ShowS
[FunctionArg] -> ShowS
FunctionArg -> String
(Int -> FunctionArg -> ShowS)
-> (FunctionArg -> String)
-> ([FunctionArg] -> ShowS)
-> Show FunctionArg
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FunctionArg -> ShowS
showsPrec :: Int -> FunctionArg -> ShowS
$cshow :: FunctionArg -> String
show :: FunctionArg -> String
$cshowList :: [FunctionArg] -> ShowS
showList :: [FunctionArg] -> ShowS
Show, FunctionArg -> FunctionArg -> Bool
(FunctionArg -> FunctionArg -> Bool)
-> (FunctionArg -> FunctionArg -> Bool) -> Eq FunctionArg
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FunctionArg -> FunctionArg -> Bool
== :: FunctionArg -> FunctionArg -> Bool
$c/= :: FunctionArg -> FunctionArg -> Bool
/= :: FunctionArg -> FunctionArg -> Bool
Eq, Eq FunctionArg
Eq FunctionArg
-> (FunctionArg -> FunctionArg -> Ordering)
-> (FunctionArg -> FunctionArg -> Bool)
-> (FunctionArg -> FunctionArg -> Bool)
-> (FunctionArg -> FunctionArg -> Bool)
-> (FunctionArg -> FunctionArg -> Bool)
-> (FunctionArg -> FunctionArg -> FunctionArg)
-> (FunctionArg -> FunctionArg -> FunctionArg)
-> Ord FunctionArg
FunctionArg -> FunctionArg -> Bool
FunctionArg -> FunctionArg -> Ordering
FunctionArg -> FunctionArg -> FunctionArg
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 :: FunctionArg -> FunctionArg -> Ordering
compare :: FunctionArg -> FunctionArg -> Ordering
$c< :: FunctionArg -> FunctionArg -> Bool
< :: FunctionArg -> FunctionArg -> Bool
$c<= :: FunctionArg -> FunctionArg -> Bool
<= :: FunctionArg -> FunctionArg -> Bool
$c> :: FunctionArg -> FunctionArg -> Bool
> :: FunctionArg -> FunctionArg -> Bool
$c>= :: FunctionArg -> FunctionArg -> Bool
>= :: FunctionArg -> FunctionArg -> Bool
$cmax :: FunctionArg -> FunctionArg -> FunctionArg
max :: FunctionArg -> FunctionArg -> FunctionArg
$cmin :: FunctionArg -> FunctionArg -> FunctionArg
min :: FunctionArg -> FunctionArg -> FunctionArg
Ord, (forall x. FunctionArg -> Rep FunctionArg x)
-> (forall x. Rep FunctionArg x -> FunctionArg)
-> Generic FunctionArg
forall x. Rep FunctionArg x -> FunctionArg
forall x. FunctionArg -> Rep FunctionArg x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FunctionArg -> Rep FunctionArg x
from :: forall x. FunctionArg -> Rep FunctionArg x
$cto :: forall x. Rep FunctionArg x -> FunctionArg
to :: forall x. Rep FunctionArg x -> FunctionArg
Generic)
instance NFData FunctionArg
instance Hashable FunctionArg
instance ToJSON FunctionArg where
toJSON :: FunctionArg -> Value
toJSON = Options -> FunctionArg -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
hasuraJSON
data ArgumentExp a
=
AETableRow
|
AEActionResponsePayload
|
AESession a
| AEInput a
deriving stock (ArgumentExp a -> ArgumentExp a -> Bool
(ArgumentExp a -> ArgumentExp a -> Bool)
-> (ArgumentExp a -> ArgumentExp a -> Bool) -> Eq (ArgumentExp a)
forall a. Eq a => ArgumentExp a -> ArgumentExp a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => ArgumentExp a -> ArgumentExp a -> Bool
== :: ArgumentExp a -> ArgumentExp a -> Bool
$c/= :: forall a. Eq a => ArgumentExp a -> ArgumentExp a -> Bool
/= :: ArgumentExp a -> ArgumentExp a -> Bool
Eq, Int -> ArgumentExp a -> ShowS
[ArgumentExp a] -> ShowS
ArgumentExp a -> String
(Int -> ArgumentExp a -> ShowS)
-> (ArgumentExp a -> String)
-> ([ArgumentExp a] -> ShowS)
-> Show (ArgumentExp a)
forall a. Show a => Int -> ArgumentExp a -> ShowS
forall a. Show a => [ArgumentExp a] -> ShowS
forall a. Show a => ArgumentExp a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> ArgumentExp a -> ShowS
showsPrec :: Int -> ArgumentExp a -> ShowS
$cshow :: forall a. Show a => ArgumentExp a -> String
show :: ArgumentExp a -> String
$cshowList :: forall a. Show a => [ArgumentExp a] -> ShowS
showList :: [ArgumentExp a] -> ShowS
Show, (forall a b. (a -> b) -> ArgumentExp a -> ArgumentExp b)
-> (forall a b. a -> ArgumentExp b -> ArgumentExp a)
-> Functor ArgumentExp
forall a b. a -> ArgumentExp b -> ArgumentExp a
forall a b. (a -> b) -> ArgumentExp a -> ArgumentExp b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> ArgumentExp a -> ArgumentExp b
fmap :: forall a b. (a -> b) -> ArgumentExp a -> ArgumentExp b
$c<$ :: forall a b. a -> ArgumentExp b -> ArgumentExp a
<$ :: forall a b. a -> ArgumentExp b -> ArgumentExp a
Functor, (forall m. Monoid m => ArgumentExp m -> m)
-> (forall m a. Monoid m => (a -> m) -> ArgumentExp a -> m)
-> (forall m a. Monoid m => (a -> m) -> ArgumentExp a -> m)
-> (forall a b. (a -> b -> b) -> b -> ArgumentExp a -> b)
-> (forall a b. (a -> b -> b) -> b -> ArgumentExp a -> b)
-> (forall b a. (b -> a -> b) -> b -> ArgumentExp a -> b)
-> (forall b a. (b -> a -> b) -> b -> ArgumentExp a -> b)
-> (forall a. (a -> a -> a) -> ArgumentExp a -> a)
-> (forall a. (a -> a -> a) -> ArgumentExp a -> a)
-> (forall a. ArgumentExp a -> [a])
-> (forall a. ArgumentExp a -> Bool)
-> (forall a. ArgumentExp a -> Int)
-> (forall a. Eq a => a -> ArgumentExp a -> Bool)
-> (forall a. Ord a => ArgumentExp a -> a)
-> (forall a. Ord a => ArgumentExp a -> a)
-> (forall a. Num a => ArgumentExp a -> a)
-> (forall a. Num a => ArgumentExp a -> a)
-> Foldable ArgumentExp
forall a. Eq a => a -> ArgumentExp a -> Bool
forall a. Num a => ArgumentExp a -> a
forall a. Ord a => ArgumentExp a -> a
forall m. Monoid m => ArgumentExp m -> m
forall a. ArgumentExp a -> Bool
forall a. ArgumentExp a -> Int
forall a. ArgumentExp a -> [a]
forall a. (a -> a -> a) -> ArgumentExp a -> a
forall m a. Monoid m => (a -> m) -> ArgumentExp a -> m
forall b a. (b -> a -> b) -> b -> ArgumentExp a -> b
forall a b. (a -> b -> b) -> b -> ArgumentExp a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
$cfold :: forall m. Monoid m => ArgumentExp m -> m
fold :: forall m. Monoid m => ArgumentExp m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> ArgumentExp a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> ArgumentExp a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> ArgumentExp a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> ArgumentExp a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> ArgumentExp a -> b
foldr :: forall a b. (a -> b -> b) -> b -> ArgumentExp a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> ArgumentExp a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> ArgumentExp a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> ArgumentExp a -> b
foldl :: forall b a. (b -> a -> b) -> b -> ArgumentExp a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> ArgumentExp a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> ArgumentExp a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> ArgumentExp a -> a
foldr1 :: forall a. (a -> a -> a) -> ArgumentExp a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> ArgumentExp a -> a
foldl1 :: forall a. (a -> a -> a) -> ArgumentExp a -> a
$ctoList :: forall a. ArgumentExp a -> [a]
toList :: forall a. ArgumentExp a -> [a]
$cnull :: forall a. ArgumentExp a -> Bool
null :: forall a. ArgumentExp a -> Bool
$clength :: forall a. ArgumentExp a -> Int
length :: forall a. ArgumentExp a -> Int
$celem :: forall a. Eq a => a -> ArgumentExp a -> Bool
elem :: forall a. Eq a => a -> ArgumentExp a -> Bool
$cmaximum :: forall a. Ord a => ArgumentExp a -> a
maximum :: forall a. Ord a => ArgumentExp a -> a
$cminimum :: forall a. Ord a => ArgumentExp a -> a
minimum :: forall a. Ord a => ArgumentExp a -> a
$csum :: forall a. Num a => ArgumentExp a -> a
sum :: forall a. Num a => ArgumentExp a -> a
$cproduct :: forall a. Num a => ArgumentExp a -> a
product :: forall a. Num a => ArgumentExp a -> a
Foldable, Functor ArgumentExp
Foldable ArgumentExp
Functor ArgumentExp
-> Foldable ArgumentExp
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ArgumentExp a -> f (ArgumentExp b))
-> (forall (f :: * -> *) a.
Applicative f =>
ArgumentExp (f a) -> f (ArgumentExp a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ArgumentExp a -> m (ArgumentExp b))
-> (forall (m :: * -> *) a.
Monad m =>
ArgumentExp (m a) -> m (ArgumentExp a))
-> Traversable ArgumentExp
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 =>
ArgumentExp (m a) -> m (ArgumentExp a)
forall (f :: * -> *) a.
Applicative f =>
ArgumentExp (f a) -> f (ArgumentExp a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ArgumentExp a -> m (ArgumentExp b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ArgumentExp a -> f (ArgumentExp b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ArgumentExp a -> f (ArgumentExp b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ArgumentExp a -> f (ArgumentExp b)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
ArgumentExp (f a) -> f (ArgumentExp a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
ArgumentExp (f a) -> f (ArgumentExp a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ArgumentExp a -> m (ArgumentExp b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ArgumentExp a -> m (ArgumentExp b)
$csequence :: forall (m :: * -> *) a.
Monad m =>
ArgumentExp (m a) -> m (ArgumentExp a)
sequence :: forall (m :: * -> *) a.
Monad m =>
ArgumentExp (m a) -> m (ArgumentExp a)
Traversable, (forall x. ArgumentExp a -> Rep (ArgumentExp a) x)
-> (forall x. Rep (ArgumentExp a) x -> ArgumentExp a)
-> Generic (ArgumentExp a)
forall x. Rep (ArgumentExp a) x -> ArgumentExp a
forall x. ArgumentExp a -> Rep (ArgumentExp a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (ArgumentExp a) x -> ArgumentExp a
forall a x. ArgumentExp a -> Rep (ArgumentExp a) x
$cfrom :: forall a x. ArgumentExp a -> Rep (ArgumentExp a) x
from :: forall x. ArgumentExp a -> Rep (ArgumentExp a) x
$cto :: forall a x. Rep (ArgumentExp a) x -> ArgumentExp a
to :: forall x. Rep (ArgumentExp a) x -> ArgumentExp a
Generic)
instance (Hashable a) => Hashable (ArgumentExp a)
onArgumentExp ::
a ->
(Text -> a) ->
ArgumentExp a ->
a
onArgumentExp :: forall a. a -> (Text -> a) -> ArgumentExp a -> a
onArgumentExp a
tableRow Text -> a
fromColumn = \case
ArgumentExp a
AETableRow -> a
tableRow
ArgumentExp a
AEActionResponsePayload -> Text -> a
fromColumn Text
actionResponsePayloadColumn
AESession a
a -> a
a
AEInput a
a -> a
a
actionResponsePayloadColumn :: Text
actionResponsePayloadColumn :: Text
actionResponsePayloadColumn = Text
"response_payload"
{-# INLINE actionResponsePayloadColumn #-}