module Hasura.Backends.Postgres.Types.Function
( ArgumentExp (..),
onArgumentExp,
actionResponsePayloadColumn,
FunctionArg (..),
HasDefault (..),
)
where
import Data.Aeson
import Hasura.Backends.Postgres.SQL.Types
import Hasura.Incremental (Cacheable)
import Hasura.Prelude
import Hasura.RQL.Types.Function
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
showList :: [HasDefault] -> ShowS
$cshowList :: [HasDefault] -> ShowS
show :: HasDefault -> String
$cshow :: HasDefault -> String
showsPrec :: Int -> HasDefault -> ShowS
$cshowsPrec :: Int -> HasDefault -> ShowS
Show, HasDefault -> HasDefault -> Bool
(HasDefault -> HasDefault -> Bool)
-> (HasDefault -> HasDefault -> Bool) -> Eq HasDefault
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HasDefault -> HasDefault -> Bool
$c/= :: HasDefault -> HasDefault -> Bool
== :: HasDefault -> HasDefault -> Bool
$c== :: HasDefault -> HasDefault -> Bool
Eq, (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
$cto :: forall x. Rep HasDefault x -> HasDefault
$cfrom :: forall x. HasDefault -> Rep HasDefault x
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
toEncodingList :: [HasDefault] -> Encoding
$ctoEncodingList :: [HasDefault] -> Encoding
toJSONList :: [HasDefault] -> Value
$ctoJSONList :: [HasDefault] -> Value
toEncoding :: HasDefault -> Encoding
$ctoEncoding :: HasDefault -> Encoding
toJSON :: HasDefault -> Value
$ctoJSON :: HasDefault -> Value
ToJSON, Eq HasDefault
Eq HasDefault
-> (Accesses -> HasDefault -> HasDefault -> Bool)
-> Cacheable HasDefault
Accesses -> HasDefault -> HasDefault -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> HasDefault -> HasDefault -> Bool
$cunchanged :: Accesses -> HasDefault -> HasDefault -> Bool
$cp1Cacheable :: Eq HasDefault
Cacheable, HasDefault -> ()
(HasDefault -> ()) -> NFData HasDefault
forall a. (a -> ()) -> NFData a
rnf :: HasDefault -> ()
$crnf :: HasDefault -> ()
NFData, Int -> HasDefault -> Int
HasDefault -> Int
(Int -> HasDefault -> Int)
-> (HasDefault -> Int) -> Hashable HasDefault
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: HasDefault -> Int
$chash :: HasDefault -> Int
hashWithSalt :: Int -> HasDefault -> Int
$chashWithSalt :: Int -> 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
showList :: [FunctionArg] -> ShowS
$cshowList :: [FunctionArg] -> ShowS
show :: FunctionArg -> String
$cshow :: FunctionArg -> String
showsPrec :: Int -> FunctionArg -> ShowS
$cshowsPrec :: Int -> FunctionArg -> ShowS
Show, FunctionArg -> FunctionArg -> Bool
(FunctionArg -> FunctionArg -> Bool)
-> (FunctionArg -> FunctionArg -> Bool) -> Eq FunctionArg
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionArg -> FunctionArg -> Bool
$c/= :: FunctionArg -> FunctionArg -> Bool
== :: FunctionArg -> FunctionArg -> Bool
$c== :: FunctionArg -> FunctionArg -> Bool
Eq, (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
$cto :: forall x. Rep FunctionArg x -> FunctionArg
$cfrom :: forall x. FunctionArg -> Rep FunctionArg x
Generic)
instance Cacheable FunctionArg
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
/= :: ArgumentExp a -> ArgumentExp a -> Bool
$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
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
showList :: [ArgumentExp a] -> ShowS
$cshowList :: forall a. Show a => [ArgumentExp a] -> ShowS
show :: ArgumentExp a -> String
$cshow :: forall a. Show a => ArgumentExp a -> String
showsPrec :: Int -> ArgumentExp a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> ArgumentExp a -> ShowS
Show, a -> ArgumentExp b -> ArgumentExp a
(a -> b) -> ArgumentExp a -> ArgumentExp b
(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
<$ :: a -> ArgumentExp b -> ArgumentExp a
$c<$ :: forall a b. a -> ArgumentExp b -> ArgumentExp a
fmap :: (a -> b) -> ArgumentExp a -> ArgumentExp b
$cfmap :: forall a b. (a -> b) -> ArgumentExp a -> ArgumentExp b
Functor, ArgumentExp a -> Bool
(a -> m) -> ArgumentExp a -> m
(a -> b -> b) -> b -> ArgumentExp a -> b
(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
product :: ArgumentExp a -> a
$cproduct :: forall a. Num a => ArgumentExp a -> a
sum :: ArgumentExp a -> a
$csum :: forall a. Num a => ArgumentExp a -> a
minimum :: ArgumentExp a -> a
$cminimum :: forall a. Ord a => ArgumentExp a -> a
maximum :: ArgumentExp a -> a
$cmaximum :: forall a. Ord a => ArgumentExp a -> a
elem :: a -> ArgumentExp a -> Bool
$celem :: forall a. Eq a => a -> ArgumentExp a -> Bool
length :: ArgumentExp a -> Int
$clength :: forall a. ArgumentExp a -> Int
null :: ArgumentExp a -> Bool
$cnull :: forall a. ArgumentExp a -> Bool
toList :: ArgumentExp a -> [a]
$ctoList :: forall a. ArgumentExp a -> [a]
foldl1 :: (a -> a -> a) -> ArgumentExp a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> ArgumentExp a -> a
foldr1 :: (a -> a -> a) -> ArgumentExp a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> ArgumentExp a -> a
foldl' :: (b -> a -> b) -> b -> ArgumentExp a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> ArgumentExp a -> b
foldl :: (b -> a -> b) -> b -> ArgumentExp a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> ArgumentExp a -> b
foldr' :: (a -> b -> b) -> b -> ArgumentExp a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> ArgumentExp a -> b
foldr :: (a -> b -> b) -> b -> ArgumentExp a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> ArgumentExp a -> b
foldMap' :: (a -> m) -> ArgumentExp a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> ArgumentExp a -> m
foldMap :: (a -> m) -> ArgumentExp a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> ArgumentExp a -> m
fold :: ArgumentExp m -> m
$cfold :: forall m. Monoid m => ArgumentExp m -> m
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
(a -> f b) -> ArgumentExp a -> f (ArgumentExp b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
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)
sequence :: ArgumentExp (m a) -> m (ArgumentExp a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
ArgumentExp (m a) -> m (ArgumentExp a)
mapM :: (a -> m b) -> ArgumentExp a -> m (ArgumentExp b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> ArgumentExp a -> m (ArgumentExp b)
sequenceA :: ArgumentExp (f a) -> f (ArgumentExp a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
ArgumentExp (f a) -> f (ArgumentExp a)
traverse :: (a -> f b) -> ArgumentExp a -> f (ArgumentExp b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> ArgumentExp a -> f (ArgumentExp b)
$cp2Traversable :: Foldable ArgumentExp
$cp1Traversable :: Functor ArgumentExp
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
$cto :: forall a x. Rep (ArgumentExp a) x -> ArgumentExp a
$cfrom :: forall a x. ArgumentExp a -> Rep (ArgumentExp a) x
Generic)
instance (Hashable a) => Hashable (ArgumentExp a)
onArgumentExp ::
a ->
(Text -> a) ->
ArgumentExp a ->
a
onArgumentExp :: 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 #-}