-- | Postgres Types BoolExp
--
-- Postgres-specific 'BooleanOperator' extensions.
module Hasura.Backends.Postgres.Types.BoolExp
  ( BooleanOperators
      ( AAncestor,
        AAncestorAny,
        AContainedIn,
        AContains,
        ADescendant,
        ADescendantAny,
        AHasKey,
        AHasKeysAll,
        AHasKeysAny,
        AILIKE,
        AIREGEX,
        AMatches,
        AMatchesAny,
        AMatchesFulltext,
        ANILIKE,
        ANIREGEX,
        ANREGEX,
        ANSIMILAR,
        AREGEX,
        ASIMILAR,
        AST3DDWithinGeom,
        AST3DIntersects,
        ASTContains,
        ASTCrosses,
        ASTDWithinGeog,
        ASTDWithinGeom,
        ASTEquals,
        ASTIntersects,
        ASTIntersectsGeomNband,
        ASTIntersectsNbandGeom,
        ASTIntersectsRast,
        ASTOverlaps,
        ASTTouches,
        ASTWithin
      ),
  )
where

import Data.Aeson.Extended
import Hasura.Incremental (Cacheable)
import Hasura.Prelude
import Hasura.RQL.IR.BoolExp

data BooleanOperators a
  = AILIKE a --     ILIKE, case insensitive
  | ANILIKE a -- NOT ILIKE, case insensitive
  | ASIMILAR a --     similar, regex
  | ANSIMILAR a -- not similar, regex
  | AREGEX a -- regex: match POSIX case sensitive
  | AIREGEX a -- regex: match POSIX case insensitive
  | ANREGEX a -- regex: dont match POSIX case sensitive
  | ANIREGEX a -- regex: dont match POSIX case insensitive
  | AContains a
  | AContainedIn a
  | AHasKey a
  | AHasKeysAny a
  | AHasKeysAll a
  | ASTContains a
  | ASTCrosses a
  | ASTEquals a
  | ASTIntersects a
  | AST3DIntersects a
  | ASTOverlaps a
  | ASTTouches a
  | ASTWithin a
  | ASTIntersectsRast a
  | ASTDWithinGeom (DWithinGeomOp a)
  | AST3DDWithinGeom (DWithinGeomOp a)
  | ASTDWithinGeog (DWithinGeogOp a)
  | ASTIntersectsGeomNband (STIntersectsGeomminNband a)
  | ASTIntersectsNbandGeom (STIntersectsNbandGeommin a)
  | AAncestor a
  | AAncestorAny a
  | ADescendant a
  | ADescendantAny a
  | AMatches a
  | AMatchesAny a
  | AMatchesFulltext a
  deriving stock (BooleanOperators a -> BooleanOperators a -> Bool
(BooleanOperators a -> BooleanOperators a -> Bool)
-> (BooleanOperators a -> BooleanOperators a -> Bool)
-> Eq (BooleanOperators a)
forall a. Eq a => BooleanOperators a -> BooleanOperators a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BooleanOperators a -> BooleanOperators a -> Bool
$c/= :: forall a. Eq a => BooleanOperators a -> BooleanOperators a -> Bool
== :: BooleanOperators a -> BooleanOperators a -> Bool
$c== :: forall a. Eq a => BooleanOperators a -> BooleanOperators a -> Bool
Eq, (forall x. BooleanOperators a -> Rep (BooleanOperators a) x)
-> (forall x. Rep (BooleanOperators a) x -> BooleanOperators a)
-> Generic (BooleanOperators a)
forall x. Rep (BooleanOperators a) x -> BooleanOperators a
forall x. BooleanOperators a -> Rep (BooleanOperators a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (BooleanOperators a) x -> BooleanOperators a
forall a x. BooleanOperators a -> Rep (BooleanOperators a) x
$cto :: forall a x. Rep (BooleanOperators a) x -> BooleanOperators a
$cfrom :: forall a x. BooleanOperators a -> Rep (BooleanOperators a) x
Generic, BooleanOperators a -> Bool
(a -> m) -> BooleanOperators a -> m
(a -> b -> b) -> b -> BooleanOperators a -> b
(forall m. Monoid m => BooleanOperators m -> m)
-> (forall m a. Monoid m => (a -> m) -> BooleanOperators a -> m)
-> (forall m a. Monoid m => (a -> m) -> BooleanOperators a -> m)
-> (forall a b. (a -> b -> b) -> b -> BooleanOperators a -> b)
-> (forall a b. (a -> b -> b) -> b -> BooleanOperators a -> b)
-> (forall b a. (b -> a -> b) -> b -> BooleanOperators a -> b)
-> (forall b a. (b -> a -> b) -> b -> BooleanOperators a -> b)
-> (forall a. (a -> a -> a) -> BooleanOperators a -> a)
-> (forall a. (a -> a -> a) -> BooleanOperators a -> a)
-> (forall a. BooleanOperators a -> [a])
-> (forall a. BooleanOperators a -> Bool)
-> (forall a. BooleanOperators a -> Int)
-> (forall a. Eq a => a -> BooleanOperators a -> Bool)
-> (forall a. Ord a => BooleanOperators a -> a)
-> (forall a. Ord a => BooleanOperators a -> a)
-> (forall a. Num a => BooleanOperators a -> a)
-> (forall a. Num a => BooleanOperators a -> a)
-> Foldable BooleanOperators
forall a. Eq a => a -> BooleanOperators a -> Bool
forall a. Num a => BooleanOperators a -> a
forall a. Ord a => BooleanOperators a -> a
forall m. Monoid m => BooleanOperators m -> m
forall a. BooleanOperators a -> Bool
forall a. BooleanOperators a -> Int
forall a. BooleanOperators a -> [a]
forall a. (a -> a -> a) -> BooleanOperators a -> a
forall m a. Monoid m => (a -> m) -> BooleanOperators a -> m
forall b a. (b -> a -> b) -> b -> BooleanOperators a -> b
forall a b. (a -> b -> b) -> b -> BooleanOperators 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 :: BooleanOperators a -> a
$cproduct :: forall a. Num a => BooleanOperators a -> a
sum :: BooleanOperators a -> a
$csum :: forall a. Num a => BooleanOperators a -> a
minimum :: BooleanOperators a -> a
$cminimum :: forall a. Ord a => BooleanOperators a -> a
maximum :: BooleanOperators a -> a
$cmaximum :: forall a. Ord a => BooleanOperators a -> a
elem :: a -> BooleanOperators a -> Bool
$celem :: forall a. Eq a => a -> BooleanOperators a -> Bool
length :: BooleanOperators a -> Int
$clength :: forall a. BooleanOperators a -> Int
null :: BooleanOperators a -> Bool
$cnull :: forall a. BooleanOperators a -> Bool
toList :: BooleanOperators a -> [a]
$ctoList :: forall a. BooleanOperators a -> [a]
foldl1 :: (a -> a -> a) -> BooleanOperators a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> BooleanOperators a -> a
foldr1 :: (a -> a -> a) -> BooleanOperators a -> a
$cfoldr1 :: forall a. (a -> a -> a) -> BooleanOperators a -> a
foldl' :: (b -> a -> b) -> b -> BooleanOperators a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> BooleanOperators a -> b
foldl :: (b -> a -> b) -> b -> BooleanOperators a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> BooleanOperators a -> b
foldr' :: (a -> b -> b) -> b -> BooleanOperators a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> BooleanOperators a -> b
foldr :: (a -> b -> b) -> b -> BooleanOperators a -> b
$cfoldr :: forall a b. (a -> b -> b) -> b -> BooleanOperators a -> b
foldMap' :: (a -> m) -> BooleanOperators a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> BooleanOperators a -> m
foldMap :: (a -> m) -> BooleanOperators a -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> BooleanOperators a -> m
fold :: BooleanOperators m -> m
$cfold :: forall m. Monoid m => BooleanOperators m -> m
Foldable, a -> BooleanOperators b -> BooleanOperators a
(a -> b) -> BooleanOperators a -> BooleanOperators b
(forall a b. (a -> b) -> BooleanOperators a -> BooleanOperators b)
-> (forall a b. a -> BooleanOperators b -> BooleanOperators a)
-> Functor BooleanOperators
forall a b. a -> BooleanOperators b -> BooleanOperators a
forall a b. (a -> b) -> BooleanOperators a -> BooleanOperators b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> BooleanOperators b -> BooleanOperators a
$c<$ :: forall a b. a -> BooleanOperators b -> BooleanOperators a
fmap :: (a -> b) -> BooleanOperators a -> BooleanOperators b
$cfmap :: forall a b. (a -> b) -> BooleanOperators a -> BooleanOperators b
Functor, Functor BooleanOperators
Foldable BooleanOperators
Functor BooleanOperators
-> Foldable BooleanOperators
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> BooleanOperators a -> f (BooleanOperators b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    BooleanOperators (f a) -> f (BooleanOperators a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> BooleanOperators a -> m (BooleanOperators b))
-> (forall (m :: * -> *) a.
    Monad m =>
    BooleanOperators (m a) -> m (BooleanOperators a))
-> Traversable BooleanOperators
(a -> f b) -> BooleanOperators a -> f (BooleanOperators 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 =>
BooleanOperators (m a) -> m (BooleanOperators a)
forall (f :: * -> *) a.
Applicative f =>
BooleanOperators (f a) -> f (BooleanOperators a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> BooleanOperators a -> m (BooleanOperators b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> BooleanOperators a -> f (BooleanOperators b)
sequence :: BooleanOperators (m a) -> m (BooleanOperators a)
$csequence :: forall (m :: * -> *) a.
Monad m =>
BooleanOperators (m a) -> m (BooleanOperators a)
mapM :: (a -> m b) -> BooleanOperators a -> m (BooleanOperators b)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> BooleanOperators a -> m (BooleanOperators b)
sequenceA :: BooleanOperators (f a) -> f (BooleanOperators a)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
BooleanOperators (f a) -> f (BooleanOperators a)
traverse :: (a -> f b) -> BooleanOperators a -> f (BooleanOperators b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> BooleanOperators a -> f (BooleanOperators b)
$cp2Traversable :: Foldable BooleanOperators
$cp1Traversable :: Functor BooleanOperators
Traversable, Int -> BooleanOperators a -> ShowS
[BooleanOperators a] -> ShowS
BooleanOperators a -> String
(Int -> BooleanOperators a -> ShowS)
-> (BooleanOperators a -> String)
-> ([BooleanOperators a] -> ShowS)
-> Show (BooleanOperators a)
forall a. Show a => Int -> BooleanOperators a -> ShowS
forall a. Show a => [BooleanOperators a] -> ShowS
forall a. Show a => BooleanOperators a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BooleanOperators a] -> ShowS
$cshowList :: forall a. Show a => [BooleanOperators a] -> ShowS
show :: BooleanOperators a -> String
$cshow :: forall a. Show a => BooleanOperators a -> String
showsPrec :: Int -> BooleanOperators a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> BooleanOperators a -> ShowS
Show)

instance NFData a => NFData (BooleanOperators a)

instance Hashable a => Hashable (BooleanOperators a)

instance Cacheable a => Cacheable (BooleanOperators a)

instance ToJSON a => ToJSONKeyValue (BooleanOperators a) where
  toJSONKeyValue :: BooleanOperators a -> (Key, Value)
toJSONKeyValue = \case
    AILIKE a
a -> (Key
"_ilike", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ANILIKE a
a -> (Key
"_nilike", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ASIMILAR a
a -> (Key
"_similar", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ANSIMILAR a
a -> (Key
"_nsimilar", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AREGEX a
a -> (Key
"_regex", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AIREGEX a
a -> (Key
"_iregex", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ANREGEX a
a -> (Key
"_nregex", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ANIREGEX a
a -> (Key
"_niregex", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AContains a
a -> (Key
"_contains", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AContainedIn a
a -> (Key
"_contained_in", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AHasKey a
a -> (Key
"_has_key", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AHasKeysAny a
a -> (Key
"_has_keys_any", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AHasKeysAll a
a -> (Key
"_has_keys_all", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ASTContains a
a -> (Key
"_st_contains", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ASTCrosses a
a -> (Key
"_st_crosses", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AST3DDWithinGeom DWithinGeomOp a
o -> (Key
"_st_3d_d_within", DWithinGeomOp a -> Value
forall a. ToJSON a => a -> Value
toJSON DWithinGeomOp a
o)
    ASTDWithinGeom DWithinGeomOp a
o -> (Key
"_st_d_within", DWithinGeomOp a -> Value
forall a. ToJSON a => a -> Value
toJSON DWithinGeomOp a
o)
    ASTDWithinGeog DWithinGeogOp a
o -> (Key
"_st_d_within", DWithinGeogOp a -> Value
forall a. ToJSON a => a -> Value
toJSON DWithinGeogOp a
o)
    ASTEquals a
a -> (Key
"_st_equals", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ASTIntersects a
a -> (Key
"_st_intersects", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AST3DIntersects a
a -> (Key
"_st_3d_intersects", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ASTOverlaps a
a -> (Key
"_st_overlaps", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ASTTouches a
a -> (Key
"_st_touches", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ASTWithin a
a -> (Key
"_st_within", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ASTIntersectsRast a
a -> (Key
"_st_intersects_rast", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ASTIntersectsNbandGeom STIntersectsNbandGeommin a
a -> (Key
"_st_intersects_nband_geom", STIntersectsNbandGeommin a -> Value
forall a. ToJSON a => a -> Value
toJSON STIntersectsNbandGeommin a
a)
    ASTIntersectsGeomNband STIntersectsGeomminNband a
a -> (Key
"_st_intersects_geom_nband", STIntersectsGeomminNband a -> Value
forall a. ToJSON a => a -> Value
toJSON STIntersectsGeomminNband a
a)
    AAncestor a
a -> (Key
"_ancestor", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AAncestorAny a
a -> (Key
"_ancestor_any", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ADescendant a
a -> (Key
"_descendant", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    ADescendantAny a
a -> (Key
"_descendant_any", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AMatches a
a -> (Key
"_matches", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AMatchesAny a
a -> (Key
"_matches_any", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)
    AMatchesFulltext a
a -> (Key
"_matches_fulltext", a -> Value
forall a. ToJSON a => a -> Value
toJSON a
a)