-- | 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.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
$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
/= :: 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
$cfrom :: forall a x. BooleanOperators a -> Rep (BooleanOperators a) x
from :: forall x. BooleanOperators a -> Rep (BooleanOperators a) x
$cto :: forall a x. Rep (BooleanOperators a) x -> BooleanOperators a
to :: forall x. Rep (BooleanOperators a) x -> BooleanOperators a
Generic, (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
$cfold :: forall m. Monoid m => BooleanOperators m -> m
fold :: forall m. Monoid m => BooleanOperators m -> m
$cfoldMap :: forall m a. Monoid m => (a -> m) -> BooleanOperators a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> BooleanOperators a -> m
$cfoldMap' :: forall m a. Monoid m => (a -> m) -> BooleanOperators a -> m
foldMap' :: forall m a. Monoid m => (a -> m) -> BooleanOperators a -> m
$cfoldr :: forall a b. (a -> b -> b) -> b -> BooleanOperators a -> b
foldr :: forall a b. (a -> b -> b) -> b -> BooleanOperators a -> b
$cfoldr' :: forall a b. (a -> b -> b) -> b -> BooleanOperators a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> BooleanOperators a -> b
$cfoldl :: forall b a. (b -> a -> b) -> b -> BooleanOperators a -> b
foldl :: forall b a. (b -> a -> b) -> b -> BooleanOperators a -> b
$cfoldl' :: forall b a. (b -> a -> b) -> b -> BooleanOperators a -> b
foldl' :: forall b a. (b -> a -> b) -> b -> BooleanOperators a -> b
$cfoldr1 :: forall a. (a -> a -> a) -> BooleanOperators a -> a
foldr1 :: forall a. (a -> a -> a) -> BooleanOperators a -> a
$cfoldl1 :: forall a. (a -> a -> a) -> BooleanOperators a -> a
foldl1 :: forall a. (a -> a -> a) -> BooleanOperators a -> a
$ctoList :: forall a. BooleanOperators a -> [a]
toList :: forall a. BooleanOperators a -> [a]
$cnull :: forall a. BooleanOperators a -> Bool
null :: forall a. BooleanOperators a -> Bool
$clength :: forall a. BooleanOperators a -> Int
length :: forall a. BooleanOperators a -> Int
$celem :: forall a. Eq a => a -> BooleanOperators a -> Bool
elem :: forall a. Eq a => a -> BooleanOperators a -> Bool
$cmaximum :: forall a. Ord a => BooleanOperators a -> a
maximum :: forall a. Ord a => BooleanOperators a -> a
$cminimum :: forall a. Ord a => BooleanOperators a -> a
minimum :: forall a. Ord a => BooleanOperators a -> a
$csum :: forall a. Num a => BooleanOperators a -> a
sum :: forall a. Num a => BooleanOperators a -> a
$cproduct :: forall a. Num a => BooleanOperators a -> a
product :: forall a. Num a => BooleanOperators a -> a
Foldable, (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
$cfmap :: forall a b. (a -> b) -> BooleanOperators a -> BooleanOperators b
fmap :: forall a b. (a -> b) -> BooleanOperators a -> BooleanOperators b
$c<$ :: forall a b. a -> BooleanOperators b -> BooleanOperators a
<$ :: forall a b. a -> BooleanOperators b -> BooleanOperators a
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
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)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> BooleanOperators a -> f (BooleanOperators b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> BooleanOperators a -> f (BooleanOperators b)
$csequenceA :: forall (f :: * -> *) a.
Applicative f =>
BooleanOperators (f a) -> f (BooleanOperators a)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
BooleanOperators (f a) -> f (BooleanOperators a)
$cmapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> BooleanOperators a -> m (BooleanOperators b)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> BooleanOperators a -> m (BooleanOperators b)
$csequence :: forall (m :: * -> *) a.
Monad m =>
BooleanOperators (m a) -> m (BooleanOperators a)
sequence :: forall (m :: * -> *) a.
Monad m =>
BooleanOperators (m a) -> m (BooleanOperators a)
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
$cshowsPrec :: forall a. Show a => Int -> BooleanOperators a -> ShowS
showsPrec :: Int -> BooleanOperators a -> ShowS
$cshow :: forall a. Show a => BooleanOperators a -> String
show :: BooleanOperators a -> String
$cshowList :: forall a. Show a => [BooleanOperators a] -> ShowS
showList :: [BooleanOperators a] -> ShowS
Show)

instance (NFData a) => NFData (BooleanOperators a)

instance (Hashable a) => Hashable (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)