module Hasura.Backends.Postgres.SQL.DML
( ColumnAlias (..),
TableAlias (..),
BinOp (AndOp, OrOp),
BoolExp (..),
TopLevelCTE (CTEDelete, CTEInsert, CTESelect, CTEUpdate),
CompareOp (SContainedIn, SContains, SEQ, SGT, SGTE, SHasKey, SHasKeysAll, SHasKeysAny, SILIKE, SIREGEX, SLIKE, SLT, SLTE, SMatchesFulltext, SNE, SNILIKE, SNIREGEX, SNLIKE, SNREGEX, SNSIMILAR, SREGEX, SSIMILAR),
CountType (CTDistinct, CTSimple, CTStar),
DistinctExpr (DistinctOn, DistinctSimple),
Extractor (..),
FromExp (..),
FromItem (..),
FunctionAlias (FunctionAlias),
FunctionDefinitionListItem (..),
FunctionArgs (FunctionArgs),
FunctionExp (FunctionExp),
GroupByExp (GroupByExp),
HavingExp (HavingExp),
JoinCond (..),
JoinExpr (JoinExpr),
JoinType (Inner, LeftOuter),
Lateral (Lateral),
LimitExp (LimitExp),
NullsOrder (NullsFirst, NullsLast),
OffsetExp (OffsetExp),
OrderByExp (..),
OrderByItem (OrderByItem, oExpression),
OrderType (OTAsc, OTDesc),
QIdentifier (QIdentifier),
Qual (QualTable, QualVar, QualifiedIdentifier),
RetExp (RetExp),
SQLConflict (..),
SQLConflictTarget (SQLColumn, SQLConstraint),
SQLDelete (SQLDelete),
SQLExp (..),
SQLInsert (SQLInsert, siCols, siConflict, siRet, siTable, siValues),
SQLOp (SQLOp),
ColumnOp (..),
SQLUpdate (..),
Select (Select, selCTEs, selDistinct, selExtr, selFrom, selLimit, selOffset, selOrderBy, selWhere),
SelectWith,
SelectWithG (SelectWith),
SetExp (SetExp),
SetExpItem (..),
TupleExp (TupleExp),
TypeAnn (TypeAnn),
ValuesExp (ValuesExp),
WhereFrag (WhereFrag),
applyJsonBuildArray,
applyJsonBuildObj,
applyRowToJson,
applyUppercase,
boolTypeAnn,
buildUpsertSetExp,
columnDefaultValue,
countStar,
handleIfNull,
incOp,
int64ToSQLExp,
intToSQLExp,
intTypeAnn,
jsonTypeAnn,
jsonbConcatOp,
jsonbDeleteAtPathOp,
jsonbDeleteOp,
jsonbPathOp,
jsonbTypeAnn,
mkExists,
mkExtr,
mkFunctionAlias,
mkIdenFromExp,
mkLateralFromItem,
mkQIdenExp,
mkQIdentifierTable,
mkQual,
mkRowExp,
mkSIdenExp,
mkSQLOpExp,
mkSelFromExp,
mkSelFromItem,
mkSelect,
mkSelectWithFromItem,
mkSimpleFromExp,
mkTypeAnn,
mulOp,
numericTypeAnn,
returningStar,
selectStar,
selectStar',
simplifyBoolExp,
textArrTypeAnn,
textTypeAnn,
toTableAlias,
toColumnAlias,
)
where
import Data.Aeson qualified as J
import Data.Aeson.Casing qualified as J
import Data.HashMap.Strict qualified as HM
import Data.Int (Int64)
import Data.String (fromString)
import Data.Text.Extended
import Hasura.Backends.Postgres.SQL.Types
import Hasura.Incremental (Cacheable)
import Hasura.Prelude
import Hasura.SQL.Types
import Text.Builder qualified as TB
data Select = Select
{
Select -> [(TableAlias, Select)]
selCTEs :: [(TableAlias, Select)],
Select -> Maybe DistinctExpr
selDistinct :: Maybe DistinctExpr,
Select -> [Extractor]
selExtr :: [Extractor],
Select -> Maybe FromExp
selFrom :: Maybe FromExp,
Select -> Maybe WhereFrag
selWhere :: Maybe WhereFrag,
Select -> Maybe GroupByExp
selGroupBy :: Maybe GroupByExp,
Select -> Maybe HavingExp
selHaving :: Maybe HavingExp,
Select -> Maybe OrderByExp
selOrderBy :: Maybe OrderByExp,
Select -> Maybe LimitExp
selLimit :: Maybe LimitExp,
Select -> Maybe OffsetExp
selOffset :: Maybe OffsetExp
}
deriving (Int -> Select -> ShowS
[Select] -> ShowS
Select -> String
(Int -> Select -> ShowS)
-> (Select -> String) -> ([Select] -> ShowS) -> Show Select
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Select] -> ShowS
$cshowList :: [Select] -> ShowS
show :: Select -> String
$cshow :: Select -> String
showsPrec :: Int -> Select -> ShowS
$cshowsPrec :: Int -> Select -> ShowS
Show, Select -> Select -> Bool
(Select -> Select -> Bool)
-> (Select -> Select -> Bool) -> Eq Select
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Select -> Select -> Bool
$c/= :: Select -> Select -> Bool
== :: Select -> Select -> Bool
$c== :: Select -> Select -> Bool
Eq, (forall x. Select -> Rep Select x)
-> (forall x. Rep Select x -> Select) -> Generic Select
forall x. Rep Select x -> Select
forall x. Select -> Rep Select x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Select x -> Select
$cfrom :: forall x. Select -> Rep Select x
Generic, Typeable Select
DataType
Constr
Typeable Select
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Select -> c Select)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Select)
-> (Select -> Constr)
-> (Select -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Select))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Select))
-> ((forall b. Data b => b -> b) -> Select -> Select)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Select -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Select -> r)
-> (forall u. (forall d. Data d => d -> u) -> Select -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Select -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Select -> m Select)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Select -> m Select)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Select -> m Select)
-> Data Select
Select -> DataType
Select -> Constr
(forall b. Data b => b -> b) -> Select -> Select
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Select -> c Select
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Select
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Select -> u
forall u. (forall d. Data d => d -> u) -> Select -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Select -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Select -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Select -> m Select
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Select -> m Select
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Select
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Select -> c Select
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Select)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Select)
$cSelect :: Constr
$tSelect :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Select -> m Select
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Select -> m Select
gmapMp :: (forall d. Data d => d -> m d) -> Select -> m Select
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Select -> m Select
gmapM :: (forall d. Data d => d -> m d) -> Select -> m Select
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Select -> m Select
gmapQi :: Int -> (forall d. Data d => d -> u) -> Select -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Select -> u
gmapQ :: (forall d. Data d => d -> u) -> Select -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Select -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Select -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Select -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Select -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Select -> r
gmapT :: (forall b. Data b => b -> b) -> Select -> Select
$cgmapT :: (forall b. Data b => b -> b) -> Select -> Select
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Select)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Select)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Select)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Select)
dataTypeOf :: Select -> DataType
$cdataTypeOf :: Select -> DataType
toConstr :: Select -> Constr
$ctoConstr :: Select -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Select
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Select
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Select -> c Select
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Select -> c Select
$cp1Data :: Typeable Select
Data)
instance NFData Select
instance Cacheable Select
instance Hashable Select
mkSelect :: Select
mkSelect :: Select
mkSelect =
[(TableAlias, Select)]
-> Maybe DistinctExpr
-> [Extractor]
-> Maybe FromExp
-> Maybe WhereFrag
-> Maybe GroupByExp
-> Maybe HavingExp
-> Maybe OrderByExp
-> Maybe LimitExp
-> Maybe OffsetExp
-> Select
Select
[]
Maybe DistinctExpr
forall a. Maybe a
Nothing
[]
Maybe FromExp
forall a. Maybe a
Nothing
Maybe WhereFrag
forall a. Maybe a
Nothing
Maybe GroupByExp
forall a. Maybe a
Nothing
Maybe HavingExp
forall a. Maybe a
Nothing
Maybe OrderByExp
forall a. Maybe a
Nothing
Maybe LimitExp
forall a. Maybe a
Nothing
Maybe OffsetExp
forall a. Maybe a
Nothing
newtype LimitExp
= LimitExp SQLExp
deriving (Int -> LimitExp -> ShowS
[LimitExp] -> ShowS
LimitExp -> String
(Int -> LimitExp -> ShowS)
-> (LimitExp -> String) -> ([LimitExp] -> ShowS) -> Show LimitExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LimitExp] -> ShowS
$cshowList :: [LimitExp] -> ShowS
show :: LimitExp -> String
$cshow :: LimitExp -> String
showsPrec :: Int -> LimitExp -> ShowS
$cshowsPrec :: Int -> LimitExp -> ShowS
Show, LimitExp -> LimitExp -> Bool
(LimitExp -> LimitExp -> Bool)
-> (LimitExp -> LimitExp -> Bool) -> Eq LimitExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LimitExp -> LimitExp -> Bool
$c/= :: LimitExp -> LimitExp -> Bool
== :: LimitExp -> LimitExp -> Bool
$c== :: LimitExp -> LimitExp -> Bool
Eq, LimitExp -> ()
(LimitExp -> ()) -> NFData LimitExp
forall a. (a -> ()) -> NFData a
rnf :: LimitExp -> ()
$crnf :: LimitExp -> ()
NFData, Typeable LimitExp
DataType
Constr
Typeable LimitExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LimitExp -> c LimitExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LimitExp)
-> (LimitExp -> Constr)
-> (LimitExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LimitExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LimitExp))
-> ((forall b. Data b => b -> b) -> LimitExp -> LimitExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LimitExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LimitExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> LimitExp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> LimitExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LimitExp -> m LimitExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LimitExp -> m LimitExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LimitExp -> m LimitExp)
-> Data LimitExp
LimitExp -> DataType
LimitExp -> Constr
(forall b. Data b => b -> b) -> LimitExp -> LimitExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LimitExp -> c LimitExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LimitExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> LimitExp -> u
forall u. (forall d. Data d => d -> u) -> LimitExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LimitExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LimitExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LimitExp -> m LimitExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LimitExp -> m LimitExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LimitExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LimitExp -> c LimitExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LimitExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LimitExp)
$cLimitExp :: Constr
$tLimitExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> LimitExp -> m LimitExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LimitExp -> m LimitExp
gmapMp :: (forall d. Data d => d -> m d) -> LimitExp -> m LimitExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> LimitExp -> m LimitExp
gmapM :: (forall d. Data d => d -> m d) -> LimitExp -> m LimitExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> LimitExp -> m LimitExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> LimitExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> LimitExp -> u
gmapQ :: (forall d. Data d => d -> u) -> LimitExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> LimitExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LimitExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> LimitExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LimitExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> LimitExp -> r
gmapT :: (forall b. Data b => b -> b) -> LimitExp -> LimitExp
$cgmapT :: (forall b. Data b => b -> b) -> LimitExp -> LimitExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LimitExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LimitExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c LimitExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c LimitExp)
dataTypeOf :: LimitExp -> DataType
$cdataTypeOf :: LimitExp -> DataType
toConstr :: LimitExp -> Constr
$ctoConstr :: LimitExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LimitExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c LimitExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LimitExp -> c LimitExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> LimitExp -> c LimitExp
$cp1Data :: Typeable LimitExp
Data, Eq LimitExp
Eq LimitExp
-> (Accesses -> LimitExp -> LimitExp -> Bool) -> Cacheable LimitExp
Accesses -> LimitExp -> LimitExp -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> LimitExp -> LimitExp -> Bool
$cunchanged :: Accesses -> LimitExp -> LimitExp -> Bool
$cp1Cacheable :: Eq LimitExp
Cacheable, Int -> LimitExp -> Int
LimitExp -> Int
(Int -> LimitExp -> Int) -> (LimitExp -> Int) -> Hashable LimitExp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: LimitExp -> Int
$chash :: LimitExp -> Int
hashWithSalt :: Int -> LimitExp -> Int
$chashWithSalt :: Int -> LimitExp -> Int
Hashable)
instance ToSQL LimitExp where
toSQL :: LimitExp -> Builder
toSQL (LimitExp SQLExp
se) =
Builder
"LIMIT" Builder -> Builder -> Builder
<~> SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
se
newtype OffsetExp
= OffsetExp SQLExp
deriving (Int -> OffsetExp -> ShowS
[OffsetExp] -> ShowS
OffsetExp -> String
(Int -> OffsetExp -> ShowS)
-> (OffsetExp -> String)
-> ([OffsetExp] -> ShowS)
-> Show OffsetExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OffsetExp] -> ShowS
$cshowList :: [OffsetExp] -> ShowS
show :: OffsetExp -> String
$cshow :: OffsetExp -> String
showsPrec :: Int -> OffsetExp -> ShowS
$cshowsPrec :: Int -> OffsetExp -> ShowS
Show, OffsetExp -> OffsetExp -> Bool
(OffsetExp -> OffsetExp -> Bool)
-> (OffsetExp -> OffsetExp -> Bool) -> Eq OffsetExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OffsetExp -> OffsetExp -> Bool
$c/= :: OffsetExp -> OffsetExp -> Bool
== :: OffsetExp -> OffsetExp -> Bool
$c== :: OffsetExp -> OffsetExp -> Bool
Eq, OffsetExp -> ()
(OffsetExp -> ()) -> NFData OffsetExp
forall a. (a -> ()) -> NFData a
rnf :: OffsetExp -> ()
$crnf :: OffsetExp -> ()
NFData, Typeable OffsetExp
DataType
Constr
Typeable OffsetExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OffsetExp -> c OffsetExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OffsetExp)
-> (OffsetExp -> Constr)
-> (OffsetExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OffsetExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OffsetExp))
-> ((forall b. Data b => b -> b) -> OffsetExp -> OffsetExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OffsetExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OffsetExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> OffsetExp -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> OffsetExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp)
-> Data OffsetExp
OffsetExp -> DataType
OffsetExp -> Constr
(forall b. Data b => b -> b) -> OffsetExp -> OffsetExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OffsetExp -> c OffsetExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OffsetExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> OffsetExp -> u
forall u. (forall d. Data d => d -> u) -> OffsetExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OffsetExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OffsetExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OffsetExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OffsetExp -> c OffsetExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OffsetExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OffsetExp)
$cOffsetExp :: Constr
$tOffsetExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp
gmapMp :: (forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp
gmapM :: (forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OffsetExp -> m OffsetExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> OffsetExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> OffsetExp -> u
gmapQ :: (forall d. Data d => d -> u) -> OffsetExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> OffsetExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OffsetExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OffsetExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OffsetExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OffsetExp -> r
gmapT :: (forall b. Data b => b -> b) -> OffsetExp -> OffsetExp
$cgmapT :: (forall b. Data b => b -> b) -> OffsetExp -> OffsetExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OffsetExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OffsetExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c OffsetExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OffsetExp)
dataTypeOf :: OffsetExp -> DataType
$cdataTypeOf :: OffsetExp -> DataType
toConstr :: OffsetExp -> Constr
$ctoConstr :: OffsetExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OffsetExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OffsetExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OffsetExp -> c OffsetExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OffsetExp -> c OffsetExp
$cp1Data :: Typeable OffsetExp
Data, Eq OffsetExp
Eq OffsetExp
-> (Accesses -> OffsetExp -> OffsetExp -> Bool)
-> Cacheable OffsetExp
Accesses -> OffsetExp -> OffsetExp -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> OffsetExp -> OffsetExp -> Bool
$cunchanged :: Accesses -> OffsetExp -> OffsetExp -> Bool
$cp1Cacheable :: Eq OffsetExp
Cacheable, Int -> OffsetExp -> Int
OffsetExp -> Int
(Int -> OffsetExp -> Int)
-> (OffsetExp -> Int) -> Hashable OffsetExp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: OffsetExp -> Int
$chash :: OffsetExp -> Int
hashWithSalt :: Int -> OffsetExp -> Int
$chashWithSalt :: Int -> OffsetExp -> Int
Hashable)
instance ToSQL OffsetExp where
toSQL :: OffsetExp -> Builder
toSQL (OffsetExp SQLExp
se) =
Builder
"OFFSET" Builder -> Builder -> Builder
<~> SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
se
newtype OrderByExp
= OrderByExp (NonEmpty OrderByItem)
deriving (Int -> OrderByExp -> ShowS
[OrderByExp] -> ShowS
OrderByExp -> String
(Int -> OrderByExp -> ShowS)
-> (OrderByExp -> String)
-> ([OrderByExp] -> ShowS)
-> Show OrderByExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderByExp] -> ShowS
$cshowList :: [OrderByExp] -> ShowS
show :: OrderByExp -> String
$cshow :: OrderByExp -> String
showsPrec :: Int -> OrderByExp -> ShowS
$cshowsPrec :: Int -> OrderByExp -> ShowS
Show, OrderByExp -> OrderByExp -> Bool
(OrderByExp -> OrderByExp -> Bool)
-> (OrderByExp -> OrderByExp -> Bool) -> Eq OrderByExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrderByExp -> OrderByExp -> Bool
$c/= :: OrderByExp -> OrderByExp -> Bool
== :: OrderByExp -> OrderByExp -> Bool
$c== :: OrderByExp -> OrderByExp -> Bool
Eq, OrderByExp -> ()
(OrderByExp -> ()) -> NFData OrderByExp
forall a. (a -> ()) -> NFData a
rnf :: OrderByExp -> ()
$crnf :: OrderByExp -> ()
NFData, Typeable OrderByExp
DataType
Constr
Typeable OrderByExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByExp -> c OrderByExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByExp)
-> (OrderByExp -> Constr)
-> (OrderByExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OrderByExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c OrderByExp))
-> ((forall b. Data b => b -> b) -> OrderByExp -> OrderByExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> OrderByExp -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> OrderByExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp)
-> Data OrderByExp
OrderByExp -> DataType
OrderByExp -> Constr
(forall b. Data b => b -> b) -> OrderByExp -> OrderByExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByExp -> c OrderByExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> OrderByExp -> u
forall u. (forall d. Data d => d -> u) -> OrderByExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByExp -> c OrderByExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OrderByExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OrderByExp)
$cOrderByExp :: Constr
$tOrderByExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp
gmapMp :: (forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp
gmapM :: (forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OrderByExp -> m OrderByExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> OrderByExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> OrderByExp -> u
gmapQ :: (forall d. Data d => d -> u) -> OrderByExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> OrderByExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByExp -> r
gmapT :: (forall b. Data b => b -> b) -> OrderByExp -> OrderByExp
$cgmapT :: (forall b. Data b => b -> b) -> OrderByExp -> OrderByExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OrderByExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OrderByExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c OrderByExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OrderByExp)
dataTypeOf :: OrderByExp -> DataType
$cdataTypeOf :: OrderByExp -> DataType
toConstr :: OrderByExp -> Constr
$ctoConstr :: OrderByExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByExp -> c OrderByExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByExp -> c OrderByExp
$cp1Data :: Typeable OrderByExp
Data, Eq OrderByExp
Eq OrderByExp
-> (Accesses -> OrderByExp -> OrderByExp -> Bool)
-> Cacheable OrderByExp
Accesses -> OrderByExp -> OrderByExp -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> OrderByExp -> OrderByExp -> Bool
$cunchanged :: Accesses -> OrderByExp -> OrderByExp -> Bool
$cp1Cacheable :: Eq OrderByExp
Cacheable, Int -> OrderByExp -> Int
OrderByExp -> Int
(Int -> OrderByExp -> Int)
-> (OrderByExp -> Int) -> Hashable OrderByExp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: OrderByExp -> Int
$chash :: OrderByExp -> Int
hashWithSalt :: Int -> OrderByExp -> Int
$chashWithSalt :: Int -> OrderByExp -> Int
Hashable)
data OrderByItem = OrderByItem
{ OrderByItem -> SQLExp
oExpression :: SQLExp,
OrderByItem -> Maybe OrderType
oOrdering :: Maybe OrderType,
OrderByItem -> Maybe NullsOrder
oNullsOrder :: Maybe NullsOrder
}
deriving (Int -> OrderByItem -> ShowS
[OrderByItem] -> ShowS
OrderByItem -> String
(Int -> OrderByItem -> ShowS)
-> (OrderByItem -> String)
-> ([OrderByItem] -> ShowS)
-> Show OrderByItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderByItem] -> ShowS
$cshowList :: [OrderByItem] -> ShowS
show :: OrderByItem -> String
$cshow :: OrderByItem -> String
showsPrec :: Int -> OrderByItem -> ShowS
$cshowsPrec :: Int -> OrderByItem -> ShowS
Show, OrderByItem -> OrderByItem -> Bool
(OrderByItem -> OrderByItem -> Bool)
-> (OrderByItem -> OrderByItem -> Bool) -> Eq OrderByItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrderByItem -> OrderByItem -> Bool
$c/= :: OrderByItem -> OrderByItem -> Bool
== :: OrderByItem -> OrderByItem -> Bool
$c== :: OrderByItem -> OrderByItem -> Bool
Eq, (forall x. OrderByItem -> Rep OrderByItem x)
-> (forall x. Rep OrderByItem x -> OrderByItem)
-> Generic OrderByItem
forall x. Rep OrderByItem x -> OrderByItem
forall x. OrderByItem -> Rep OrderByItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OrderByItem x -> OrderByItem
$cfrom :: forall x. OrderByItem -> Rep OrderByItem x
Generic, Typeable OrderByItem
DataType
Constr
Typeable OrderByItem
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByItem -> c OrderByItem)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByItem)
-> (OrderByItem -> Constr)
-> (OrderByItem -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OrderByItem))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c OrderByItem))
-> ((forall b. Data b => b -> b) -> OrderByItem -> OrderByItem)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByItem -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByItem -> r)
-> (forall u. (forall d. Data d => d -> u) -> OrderByItem -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> OrderByItem -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem)
-> Data OrderByItem
OrderByItem -> DataType
OrderByItem -> Constr
(forall b. Data b => b -> b) -> OrderByItem -> OrderByItem
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByItem -> c OrderByItem
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByItem
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> OrderByItem -> u
forall u. (forall d. Data d => d -> u) -> OrderByItem -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByItem -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByItem -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByItem
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByItem -> c OrderByItem
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OrderByItem)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c OrderByItem)
$cOrderByItem :: Constr
$tOrderByItem :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem
gmapMp :: (forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem
gmapM :: (forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OrderByItem -> m OrderByItem
gmapQi :: Int -> (forall d. Data d => d -> u) -> OrderByItem -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> OrderByItem -> u
gmapQ :: (forall d. Data d => d -> u) -> OrderByItem -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> OrderByItem -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByItem -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByItem -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByItem -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderByItem -> r
gmapT :: (forall b. Data b => b -> b) -> OrderByItem -> OrderByItem
$cgmapT :: (forall b. Data b => b -> b) -> OrderByItem -> OrderByItem
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c OrderByItem)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c OrderByItem)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c OrderByItem)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OrderByItem)
dataTypeOf :: OrderByItem -> DataType
$cdataTypeOf :: OrderByItem -> DataType
toConstr :: OrderByItem -> Constr
$ctoConstr :: OrderByItem -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByItem
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderByItem
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByItem -> c OrderByItem
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderByItem -> c OrderByItem
$cp1Data :: Typeable OrderByItem
Data)
instance NFData OrderByItem
instance Cacheable OrderByItem
instance Hashable OrderByItem
instance ToSQL OrderByItem where
toSQL :: OrderByItem -> Builder
toSQL (OrderByItem SQLExp
expr Maybe OrderType
ordering Maybe NullsOrder
nullsOrder) =
SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
expr Builder -> Builder -> Builder
<~> Maybe OrderType -> Builder
forall a. ToSQL a => a -> Builder
toSQL Maybe OrderType
ordering Builder -> Builder -> Builder
<~> Maybe NullsOrder -> Builder
forall a. ToSQL a => a -> Builder
toSQL Maybe NullsOrder
nullsOrder
data OrderType = OTAsc | OTDesc
deriving (Int -> OrderType -> ShowS
[OrderType] -> ShowS
OrderType -> String
(Int -> OrderType -> ShowS)
-> (OrderType -> String)
-> ([OrderType] -> ShowS)
-> Show OrderType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderType] -> ShowS
$cshowList :: [OrderType] -> ShowS
show :: OrderType -> String
$cshow :: OrderType -> String
showsPrec :: Int -> OrderType -> ShowS
$cshowsPrec :: Int -> OrderType -> ShowS
Show, OrderType -> OrderType -> Bool
(OrderType -> OrderType -> Bool)
-> (OrderType -> OrderType -> Bool) -> Eq OrderType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrderType -> OrderType -> Bool
$c/= :: OrderType -> OrderType -> Bool
== :: OrderType -> OrderType -> Bool
$c== :: OrderType -> OrderType -> Bool
Eq, (forall x. OrderType -> Rep OrderType x)
-> (forall x. Rep OrderType x -> OrderType) -> Generic OrderType
forall x. Rep OrderType x -> OrderType
forall x. OrderType -> Rep OrderType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OrderType x -> OrderType
$cfrom :: forall x. OrderType -> Rep OrderType x
Generic, Typeable OrderType
DataType
Constr
Typeable OrderType
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderType -> c OrderType)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderType)
-> (OrderType -> Constr)
-> (OrderType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OrderType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OrderType))
-> ((forall b. Data b => b -> b) -> OrderType -> OrderType)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderType -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderType -> r)
-> (forall u. (forall d. Data d => d -> u) -> OrderType -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> OrderType -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OrderType -> m OrderType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderType -> m OrderType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderType -> m OrderType)
-> Data OrderType
OrderType -> DataType
OrderType -> Constr
(forall b. Data b => b -> b) -> OrderType -> OrderType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderType -> c OrderType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderType
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> OrderType -> u
forall u. (forall d. Data d => d -> u) -> OrderType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OrderType -> m OrderType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderType -> m OrderType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderType -> c OrderType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OrderType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OrderType)
$cOTDesc :: Constr
$cOTAsc :: Constr
$tOrderType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> OrderType -> m OrderType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderType -> m OrderType
gmapMp :: (forall d. Data d => d -> m d) -> OrderType -> m OrderType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> OrderType -> m OrderType
gmapM :: (forall d. Data d => d -> m d) -> OrderType -> m OrderType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> OrderType -> m OrderType
gmapQi :: Int -> (forall d. Data d => d -> u) -> OrderType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> OrderType -> u
gmapQ :: (forall d. Data d => d -> u) -> OrderType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> OrderType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> OrderType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> OrderType -> r
gmapT :: (forall b. Data b => b -> b) -> OrderType -> OrderType
$cgmapT :: (forall b. Data b => b -> b) -> OrderType -> OrderType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OrderType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c OrderType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c OrderType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c OrderType)
dataTypeOf :: OrderType -> DataType
$cdataTypeOf :: OrderType -> DataType
toConstr :: OrderType -> Constr
$ctoConstr :: OrderType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c OrderType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderType -> c OrderType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> OrderType -> c OrderType
$cp1Data :: Typeable OrderType
Data)
instance NFData OrderType
instance Cacheable OrderType
instance Hashable OrderType
instance ToSQL OrderType where
toSQL :: OrderType -> Builder
toSQL OrderType
OTAsc = Builder
"ASC"
toSQL OrderType
OTDesc = Builder
"DESC"
instance J.FromJSON OrderType where
parseJSON :: Value -> Parser OrderType
parseJSON = Options -> Value -> Parser OrderType
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
J.genericParseJSON (Options -> Value -> Parser OrderType)
-> Options -> Value -> Parser OrderType
forall a b. (a -> b) -> a -> b
$ Options
J.defaultOptions {constructorTagModifier :: ShowS
J.constructorTagModifier = ShowS
J.snakeCase ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ShowS
forall a. Int -> [a] -> [a]
drop Int
2}
instance J.ToJSON OrderType where
toJSON :: OrderType -> Value
toJSON = Options -> OrderType -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON (Options -> OrderType -> Value) -> Options -> OrderType -> Value
forall a b. (a -> b) -> a -> b
$ Options
J.defaultOptions {constructorTagModifier :: ShowS
J.constructorTagModifier = ShowS
J.snakeCase ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ShowS
forall a. Int -> [a] -> [a]
drop Int
2}
data NullsOrder
= NullsFirst
| NullsLast
deriving (Int -> NullsOrder -> ShowS
[NullsOrder] -> ShowS
NullsOrder -> String
(Int -> NullsOrder -> ShowS)
-> (NullsOrder -> String)
-> ([NullsOrder] -> ShowS)
-> Show NullsOrder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NullsOrder] -> ShowS
$cshowList :: [NullsOrder] -> ShowS
show :: NullsOrder -> String
$cshow :: NullsOrder -> String
showsPrec :: Int -> NullsOrder -> ShowS
$cshowsPrec :: Int -> NullsOrder -> ShowS
Show, NullsOrder -> NullsOrder -> Bool
(NullsOrder -> NullsOrder -> Bool)
-> (NullsOrder -> NullsOrder -> Bool) -> Eq NullsOrder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NullsOrder -> NullsOrder -> Bool
$c/= :: NullsOrder -> NullsOrder -> Bool
== :: NullsOrder -> NullsOrder -> Bool
$c== :: NullsOrder -> NullsOrder -> Bool
Eq, (forall x. NullsOrder -> Rep NullsOrder x)
-> (forall x. Rep NullsOrder x -> NullsOrder) -> Generic NullsOrder
forall x. Rep NullsOrder x -> NullsOrder
forall x. NullsOrder -> Rep NullsOrder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NullsOrder x -> NullsOrder
$cfrom :: forall x. NullsOrder -> Rep NullsOrder x
Generic, Typeable NullsOrder
DataType
Constr
Typeable NullsOrder
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NullsOrder -> c NullsOrder)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NullsOrder)
-> (NullsOrder -> Constr)
-> (NullsOrder -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NullsOrder))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c NullsOrder))
-> ((forall b. Data b => b -> b) -> NullsOrder -> NullsOrder)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NullsOrder -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NullsOrder -> r)
-> (forall u. (forall d. Data d => d -> u) -> NullsOrder -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> NullsOrder -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder)
-> Data NullsOrder
NullsOrder -> DataType
NullsOrder -> Constr
(forall b. Data b => b -> b) -> NullsOrder -> NullsOrder
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NullsOrder -> c NullsOrder
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NullsOrder
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> NullsOrder -> u
forall u. (forall d. Data d => d -> u) -> NullsOrder -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NullsOrder -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NullsOrder -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NullsOrder
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NullsOrder -> c NullsOrder
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NullsOrder)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NullsOrder)
$cNullsLast :: Constr
$cNullsFirst :: Constr
$tNullsOrder :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder
gmapMp :: (forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder
gmapM :: (forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> NullsOrder -> m NullsOrder
gmapQi :: Int -> (forall d. Data d => d -> u) -> NullsOrder -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> NullsOrder -> u
gmapQ :: (forall d. Data d => d -> u) -> NullsOrder -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> NullsOrder -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NullsOrder -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> NullsOrder -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NullsOrder -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> NullsOrder -> r
gmapT :: (forall b. Data b => b -> b) -> NullsOrder -> NullsOrder
$cgmapT :: (forall b. Data b => b -> b) -> NullsOrder -> NullsOrder
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NullsOrder)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c NullsOrder)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c NullsOrder)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c NullsOrder)
dataTypeOf :: NullsOrder -> DataType
$cdataTypeOf :: NullsOrder -> DataType
toConstr :: NullsOrder -> Constr
$ctoConstr :: NullsOrder -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NullsOrder
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c NullsOrder
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NullsOrder -> c NullsOrder
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> NullsOrder -> c NullsOrder
$cp1Data :: Typeable NullsOrder
Data)
instance NFData NullsOrder
instance Cacheable NullsOrder
instance Hashable NullsOrder
instance ToSQL NullsOrder where
toSQL :: NullsOrder -> Builder
toSQL NullsOrder
NullsFirst = Builder
"NULLS FIRST"
toSQL NullsOrder
NullsLast = Builder
"NULLS LAST"
instance J.FromJSON NullsOrder where
parseJSON :: Value -> Parser NullsOrder
parseJSON = Options -> Value -> Parser NullsOrder
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
J.genericParseJSON (Options -> Value -> Parser NullsOrder)
-> Options -> Value -> Parser NullsOrder
forall a b. (a -> b) -> a -> b
$ Options
J.defaultOptions {constructorTagModifier :: ShowS
J.constructorTagModifier = ShowS
J.snakeCase ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ShowS
forall a. Int -> [a] -> [a]
drop Int
5}
instance J.ToJSON NullsOrder where
toJSON :: NullsOrder -> Value
toJSON = Options -> NullsOrder -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
J.genericToJSON (Options -> NullsOrder -> Value) -> Options -> NullsOrder -> Value
forall a b. (a -> b) -> a -> b
$ Options
J.defaultOptions {constructorTagModifier :: ShowS
J.constructorTagModifier = ShowS
J.snakeCase ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ShowS
forall a. Int -> [a] -> [a]
drop Int
5}
instance ToSQL OrderByExp where
toSQL :: OrderByExp -> Builder
toSQL (OrderByExp NonEmpty OrderByItem
l) =
Builder
"ORDER BY" Builder -> Builder -> Builder
<~> (Text
", " Text -> [OrderByItem] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> NonEmpty OrderByItem -> [OrderByItem]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList NonEmpty OrderByItem
l)
newtype GroupByExp
= GroupByExp [SQLExp]
deriving (Int -> GroupByExp -> ShowS
[GroupByExp] -> ShowS
GroupByExp -> String
(Int -> GroupByExp -> ShowS)
-> (GroupByExp -> String)
-> ([GroupByExp] -> ShowS)
-> Show GroupByExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GroupByExp] -> ShowS
$cshowList :: [GroupByExp] -> ShowS
show :: GroupByExp -> String
$cshow :: GroupByExp -> String
showsPrec :: Int -> GroupByExp -> ShowS
$cshowsPrec :: Int -> GroupByExp -> ShowS
Show, GroupByExp -> GroupByExp -> Bool
(GroupByExp -> GroupByExp -> Bool)
-> (GroupByExp -> GroupByExp -> Bool) -> Eq GroupByExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GroupByExp -> GroupByExp -> Bool
$c/= :: GroupByExp -> GroupByExp -> Bool
== :: GroupByExp -> GroupByExp -> Bool
$c== :: GroupByExp -> GroupByExp -> Bool
Eq, GroupByExp -> ()
(GroupByExp -> ()) -> NFData GroupByExp
forall a. (a -> ()) -> NFData a
rnf :: GroupByExp -> ()
$crnf :: GroupByExp -> ()
NFData, Typeable GroupByExp
DataType
Constr
Typeable GroupByExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> GroupByExp -> c GroupByExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GroupByExp)
-> (GroupByExp -> Constr)
-> (GroupByExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c GroupByExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c GroupByExp))
-> ((forall b. Data b => b -> b) -> GroupByExp -> GroupByExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GroupByExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GroupByExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> GroupByExp -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> GroupByExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp)
-> Data GroupByExp
GroupByExp -> DataType
GroupByExp -> Constr
(forall b. Data b => b -> b) -> GroupByExp -> GroupByExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> GroupByExp -> c GroupByExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GroupByExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> GroupByExp -> u
forall u. (forall d. Data d => d -> u) -> GroupByExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GroupByExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GroupByExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GroupByExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> GroupByExp -> c GroupByExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c GroupByExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GroupByExp)
$cGroupByExp :: Constr
$tGroupByExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp
gmapMp :: (forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp
gmapM :: (forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> GroupByExp -> m GroupByExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> GroupByExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> GroupByExp -> u
gmapQ :: (forall d. Data d => d -> u) -> GroupByExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> GroupByExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GroupByExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> GroupByExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GroupByExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> GroupByExp -> r
gmapT :: (forall b. Data b => b -> b) -> GroupByExp -> GroupByExp
$cgmapT :: (forall b. Data b => b -> b) -> GroupByExp -> GroupByExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GroupByExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c GroupByExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c GroupByExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c GroupByExp)
dataTypeOf :: GroupByExp -> DataType
$cdataTypeOf :: GroupByExp -> DataType
toConstr :: GroupByExp -> Constr
$ctoConstr :: GroupByExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GroupByExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c GroupByExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> GroupByExp -> c GroupByExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> GroupByExp -> c GroupByExp
$cp1Data :: Typeable GroupByExp
Data, Eq GroupByExp
Eq GroupByExp
-> (Accesses -> GroupByExp -> GroupByExp -> Bool)
-> Cacheable GroupByExp
Accesses -> GroupByExp -> GroupByExp -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> GroupByExp -> GroupByExp -> Bool
$cunchanged :: Accesses -> GroupByExp -> GroupByExp -> Bool
$cp1Cacheable :: Eq GroupByExp
Cacheable, Int -> GroupByExp -> Int
GroupByExp -> Int
(Int -> GroupByExp -> Int)
-> (GroupByExp -> Int) -> Hashable GroupByExp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: GroupByExp -> Int
$chash :: GroupByExp -> Int
hashWithSalt :: Int -> GroupByExp -> Int
$chashWithSalt :: Int -> GroupByExp -> Int
Hashable)
instance ToSQL GroupByExp where
toSQL :: GroupByExp -> Builder
toSQL (GroupByExp [SQLExp]
idens) =
Builder
"GROUP BY" Builder -> Builder -> Builder
<~> (Text
", " Text -> [SQLExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [SQLExp]
idens)
newtype FromExp
= FromExp [FromItem]
deriving (Int -> FromExp -> ShowS
[FromExp] -> ShowS
FromExp -> String
(Int -> FromExp -> ShowS)
-> (FromExp -> String) -> ([FromExp] -> ShowS) -> Show FromExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FromExp] -> ShowS
$cshowList :: [FromExp] -> ShowS
show :: FromExp -> String
$cshow :: FromExp -> String
showsPrec :: Int -> FromExp -> ShowS
$cshowsPrec :: Int -> FromExp -> ShowS
Show, FromExp -> FromExp -> Bool
(FromExp -> FromExp -> Bool)
-> (FromExp -> FromExp -> Bool) -> Eq FromExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FromExp -> FromExp -> Bool
$c/= :: FromExp -> FromExp -> Bool
== :: FromExp -> FromExp -> Bool
$c== :: FromExp -> FromExp -> Bool
Eq, FromExp -> ()
(FromExp -> ()) -> NFData FromExp
forall a. (a -> ()) -> NFData a
rnf :: FromExp -> ()
$crnf :: FromExp -> ()
NFData, Typeable FromExp
DataType
Constr
Typeable FromExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromExp -> c FromExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromExp)
-> (FromExp -> Constr)
-> (FromExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FromExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FromExp))
-> ((forall b. Data b => b -> b) -> FromExp -> FromExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FromExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FromExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> FromExp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FromExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FromExp -> m FromExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromExp -> m FromExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromExp -> m FromExp)
-> Data FromExp
FromExp -> DataType
FromExp -> Constr
(forall b. Data b => b -> b) -> FromExp -> FromExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromExp -> c FromExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FromExp -> u
forall u. (forall d. Data d => d -> u) -> FromExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FromExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FromExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FromExp -> m FromExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromExp -> m FromExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromExp -> c FromExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FromExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FromExp)
$cFromExp :: Constr
$tFromExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FromExp -> m FromExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromExp -> m FromExp
gmapMp :: (forall d. Data d => d -> m d) -> FromExp -> m FromExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromExp -> m FromExp
gmapM :: (forall d. Data d => d -> m d) -> FromExp -> m FromExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FromExp -> m FromExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> FromExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FromExp -> u
gmapQ :: (forall d. Data d => d -> u) -> FromExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FromExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FromExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FromExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FromExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FromExp -> r
gmapT :: (forall b. Data b => b -> b) -> FromExp -> FromExp
$cgmapT :: (forall b. Data b => b -> b) -> FromExp -> FromExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FromExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FromExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FromExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FromExp)
dataTypeOf :: FromExp -> DataType
$cdataTypeOf :: FromExp -> DataType
toConstr :: FromExp -> Constr
$ctoConstr :: FromExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromExp -> c FromExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromExp -> c FromExp
$cp1Data :: Typeable FromExp
Data, Eq FromExp
Eq FromExp
-> (Accesses -> FromExp -> FromExp -> Bool) -> Cacheable FromExp
Accesses -> FromExp -> FromExp -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> FromExp -> FromExp -> Bool
$cunchanged :: Accesses -> FromExp -> FromExp -> Bool
$cp1Cacheable :: Eq FromExp
Cacheable, Int -> FromExp -> Int
FromExp -> Int
(Int -> FromExp -> Int) -> (FromExp -> Int) -> Hashable FromExp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: FromExp -> Int
$chash :: FromExp -> Int
hashWithSalt :: Int -> FromExp -> Int
$chashWithSalt :: Int -> FromExp -> Int
Hashable)
instance ToSQL FromExp where
toSQL :: FromExp -> Builder
toSQL (FromExp [FromItem]
items) =
Builder
"FROM" Builder -> Builder -> Builder
<~> (Text
", " Text -> [FromItem] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [FromItem]
items)
mkIdenFromExp :: (IsIdentifier a) => a -> FromExp
mkIdenFromExp :: a -> FromExp
mkIdenFromExp a
a =
[FromItem] -> FromExp
FromExp [Identifier -> FromItem
FIIdentifier (Identifier -> FromItem) -> Identifier -> FromItem
forall a b. (a -> b) -> a -> b
$ a -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier a
a]
mkSimpleFromExp :: QualifiedTable -> FromExp
mkSimpleFromExp :: QualifiedTable -> FromExp
mkSimpleFromExp QualifiedTable
qt =
[FromItem] -> FromExp
FromExp [QualifiedTable -> Maybe TableAlias -> FromItem
FISimple QualifiedTable
qt Maybe TableAlias
forall a. Maybe a
Nothing]
mkSelFromExp :: Bool -> Select -> TableName -> FromItem
mkSelFromExp :: Bool -> Select -> TableName -> FromItem
mkSelFromExp Bool
isLateral Select
sel TableName
tn =
Lateral -> Select -> TableAlias -> FromItem
FISelect (Bool -> Lateral
Lateral Bool
isLateral) Select
sel TableAlias
alias
where
alias :: TableAlias
alias = Identifier -> TableAlias
forall a. IsIdentifier a => a -> TableAlias
toTableAlias (Identifier -> TableAlias) -> Identifier -> TableAlias
forall a b. (a -> b) -> a -> b
$ TableName -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier TableName
tn
mkRowExp :: [Extractor] -> SQLExp
mkRowExp :: [Extractor] -> SQLExp
mkRowExp [Extractor]
extrs =
let innerSel :: Select
innerSel = Select
mkSelect {selExtr :: [Extractor]
selExtr = [Extractor]
extrs}
innerSelName :: TableName
innerSelName = Text -> TableName
TableName Text
"e"
outerSel :: Select
outerSel =
Select
mkSelect
{ selExtr :: [Extractor]
selExtr = [SQLExp -> Maybe ColumnAlias -> Extractor
Extractor (Identifier -> SQLExp
SERowIdentifier (Identifier -> SQLExp) -> Identifier -> SQLExp
forall a b. (a -> b) -> a -> b
$ TableName -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier TableName
innerSelName) Maybe ColumnAlias
forall a. Maybe a
Nothing],
selFrom :: Maybe FromExp
selFrom =
FromExp -> Maybe FromExp
forall a. a -> Maybe a
Just (FromExp -> Maybe FromExp) -> FromExp -> Maybe FromExp
forall a b. (a -> b) -> a -> b
$
[FromItem] -> FromExp
FromExp
[Bool -> Select -> TableName -> FromItem
mkSelFromExp Bool
False Select
innerSel TableName
innerSelName]
}
in Select -> SQLExp
SESelect Select
outerSel
newtype HavingExp
= HavingExp BoolExp
deriving (Int -> HavingExp -> ShowS
[HavingExp] -> ShowS
HavingExp -> String
(Int -> HavingExp -> ShowS)
-> (HavingExp -> String)
-> ([HavingExp] -> ShowS)
-> Show HavingExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HavingExp] -> ShowS
$cshowList :: [HavingExp] -> ShowS
show :: HavingExp -> String
$cshow :: HavingExp -> String
showsPrec :: Int -> HavingExp -> ShowS
$cshowsPrec :: Int -> HavingExp -> ShowS
Show, HavingExp -> HavingExp -> Bool
(HavingExp -> HavingExp -> Bool)
-> (HavingExp -> HavingExp -> Bool) -> Eq HavingExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HavingExp -> HavingExp -> Bool
$c/= :: HavingExp -> HavingExp -> Bool
== :: HavingExp -> HavingExp -> Bool
$c== :: HavingExp -> HavingExp -> Bool
Eq, HavingExp -> ()
(HavingExp -> ()) -> NFData HavingExp
forall a. (a -> ()) -> NFData a
rnf :: HavingExp -> ()
$crnf :: HavingExp -> ()
NFData, Typeable HavingExp
DataType
Constr
Typeable HavingExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HavingExp -> c HavingExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HavingExp)
-> (HavingExp -> Constr)
-> (HavingExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HavingExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HavingExp))
-> ((forall b. Data b => b -> b) -> HavingExp -> HavingExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HavingExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HavingExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> HavingExp -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> HavingExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HavingExp -> m HavingExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HavingExp -> m HavingExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HavingExp -> m HavingExp)
-> Data HavingExp
HavingExp -> DataType
HavingExp -> Constr
(forall b. Data b => b -> b) -> HavingExp -> HavingExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HavingExp -> c HavingExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HavingExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> HavingExp -> u
forall u. (forall d. Data d => d -> u) -> HavingExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HavingExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HavingExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HavingExp -> m HavingExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HavingExp -> m HavingExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HavingExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HavingExp -> c HavingExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HavingExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HavingExp)
$cHavingExp :: Constr
$tHavingExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> HavingExp -> m HavingExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HavingExp -> m HavingExp
gmapMp :: (forall d. Data d => d -> m d) -> HavingExp -> m HavingExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> HavingExp -> m HavingExp
gmapM :: (forall d. Data d => d -> m d) -> HavingExp -> m HavingExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> HavingExp -> m HavingExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> HavingExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> HavingExp -> u
gmapQ :: (forall d. Data d => d -> u) -> HavingExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> HavingExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HavingExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> HavingExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HavingExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> HavingExp -> r
gmapT :: (forall b. Data b => b -> b) -> HavingExp -> HavingExp
$cgmapT :: (forall b. Data b => b -> b) -> HavingExp -> HavingExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HavingExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HavingExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c HavingExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c HavingExp)
dataTypeOf :: HavingExp -> DataType
$cdataTypeOf :: HavingExp -> DataType
toConstr :: HavingExp -> Constr
$ctoConstr :: HavingExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HavingExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c HavingExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HavingExp -> c HavingExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> HavingExp -> c HavingExp
$cp1Data :: Typeable HavingExp
Data, Eq HavingExp
Eq HavingExp
-> (Accesses -> HavingExp -> HavingExp -> Bool)
-> Cacheable HavingExp
Accesses -> HavingExp -> HavingExp -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> HavingExp -> HavingExp -> Bool
$cunchanged :: Accesses -> HavingExp -> HavingExp -> Bool
$cp1Cacheable :: Eq HavingExp
Cacheable, Int -> HavingExp -> Int
HavingExp -> Int
(Int -> HavingExp -> Int)
-> (HavingExp -> Int) -> Hashable HavingExp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: HavingExp -> Int
$chash :: HavingExp -> Int
hashWithSalt :: Int -> HavingExp -> Int
$chashWithSalt :: Int -> HavingExp -> Int
Hashable)
instance ToSQL HavingExp where
toSQL :: HavingExp -> Builder
toSQL (HavingExp BoolExp
be) =
Builder
"HAVING" Builder -> Builder -> Builder
<~> BoolExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL BoolExp
be
newtype WhereFrag = WhereFrag {WhereFrag -> BoolExp
getWFBoolExp :: BoolExp}
deriving (Int -> WhereFrag -> ShowS
[WhereFrag] -> ShowS
WhereFrag -> String
(Int -> WhereFrag -> ShowS)
-> (WhereFrag -> String)
-> ([WhereFrag] -> ShowS)
-> Show WhereFrag
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WhereFrag] -> ShowS
$cshowList :: [WhereFrag] -> ShowS
show :: WhereFrag -> String
$cshow :: WhereFrag -> String
showsPrec :: Int -> WhereFrag -> ShowS
$cshowsPrec :: Int -> WhereFrag -> ShowS
Show, WhereFrag -> WhereFrag -> Bool
(WhereFrag -> WhereFrag -> Bool)
-> (WhereFrag -> WhereFrag -> Bool) -> Eq WhereFrag
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WhereFrag -> WhereFrag -> Bool
$c/= :: WhereFrag -> WhereFrag -> Bool
== :: WhereFrag -> WhereFrag -> Bool
$c== :: WhereFrag -> WhereFrag -> Bool
Eq, WhereFrag -> ()
(WhereFrag -> ()) -> NFData WhereFrag
forall a. (a -> ()) -> NFData a
rnf :: WhereFrag -> ()
$crnf :: WhereFrag -> ()
NFData, Typeable WhereFrag
DataType
Constr
Typeable WhereFrag
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WhereFrag -> c WhereFrag)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WhereFrag)
-> (WhereFrag -> Constr)
-> (WhereFrag -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WhereFrag))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WhereFrag))
-> ((forall b. Data b => b -> b) -> WhereFrag -> WhereFrag)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereFrag -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereFrag -> r)
-> (forall u. (forall d. Data d => d -> u) -> WhereFrag -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> WhereFrag -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag)
-> Data WhereFrag
WhereFrag -> DataType
WhereFrag -> Constr
(forall b. Data b => b -> b) -> WhereFrag -> WhereFrag
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WhereFrag -> c WhereFrag
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WhereFrag
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> WhereFrag -> u
forall u. (forall d. Data d => d -> u) -> WhereFrag -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereFrag -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereFrag -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WhereFrag
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WhereFrag -> c WhereFrag
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WhereFrag)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WhereFrag)
$cWhereFrag :: Constr
$tWhereFrag :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag
gmapMp :: (forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag
gmapM :: (forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> WhereFrag -> m WhereFrag
gmapQi :: Int -> (forall d. Data d => d -> u) -> WhereFrag -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> WhereFrag -> u
gmapQ :: (forall d. Data d => d -> u) -> WhereFrag -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> WhereFrag -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereFrag -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> WhereFrag -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereFrag -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> WhereFrag -> r
gmapT :: (forall b. Data b => b -> b) -> WhereFrag -> WhereFrag
$cgmapT :: (forall b. Data b => b -> b) -> WhereFrag -> WhereFrag
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WhereFrag)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WhereFrag)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c WhereFrag)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c WhereFrag)
dataTypeOf :: WhereFrag -> DataType
$cdataTypeOf :: WhereFrag -> DataType
toConstr :: WhereFrag -> Constr
$ctoConstr :: WhereFrag -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WhereFrag
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c WhereFrag
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WhereFrag -> c WhereFrag
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> WhereFrag -> c WhereFrag
$cp1Data :: Typeable WhereFrag
Data, Eq WhereFrag
Eq WhereFrag
-> (Accesses -> WhereFrag -> WhereFrag -> Bool)
-> Cacheable WhereFrag
Accesses -> WhereFrag -> WhereFrag -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> WhereFrag -> WhereFrag -> Bool
$cunchanged :: Accesses -> WhereFrag -> WhereFrag -> Bool
$cp1Cacheable :: Eq WhereFrag
Cacheable, Int -> WhereFrag -> Int
WhereFrag -> Int
(Int -> WhereFrag -> Int)
-> (WhereFrag -> Int) -> Hashable WhereFrag
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: WhereFrag -> Int
$chash :: WhereFrag -> Int
hashWithSalt :: Int -> WhereFrag -> Int
$chashWithSalt :: Int -> WhereFrag -> Int
Hashable)
instance ToSQL WhereFrag where
toSQL :: WhereFrag -> Builder
toSQL (WhereFrag BoolExp
be) =
Builder
"WHERE" Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (BoolExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL BoolExp
be)
instance ToSQL Select where
toSQL :: Select -> Builder
toSQL Select
sel = case Select -> [(TableAlias, Select)]
selCTEs Select
sel of
[] ->
Builder
"SELECT"
Builder -> Builder -> Builder
<~> Maybe DistinctExpr -> Builder
forall a. ToSQL a => a -> Builder
toSQL (Select -> Maybe DistinctExpr
selDistinct Select
sel)
Builder -> Builder -> Builder
<~> (Text
", " Text -> [Extractor] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> Select -> [Extractor]
selExtr Select
sel)
Builder -> Builder -> Builder
<~> Maybe FromExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (Select -> Maybe FromExp
selFrom Select
sel)
Builder -> Builder -> Builder
<~> Maybe WhereFrag -> Builder
forall a. ToSQL a => a -> Builder
toSQL (Select -> Maybe WhereFrag
selWhere Select
sel)
Builder -> Builder -> Builder
<~> Maybe GroupByExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (Select -> Maybe GroupByExp
selGroupBy Select
sel)
Builder -> Builder -> Builder
<~> Maybe HavingExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (Select -> Maybe HavingExp
selHaving Select
sel)
Builder -> Builder -> Builder
<~> Maybe OrderByExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (Select -> Maybe OrderByExp
selOrderBy Select
sel)
Builder -> Builder -> Builder
<~> Maybe LimitExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (Select -> Maybe LimitExp
selLimit Select
sel)
Builder -> Builder -> Builder
<~> Maybe OffsetExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (Select -> Maybe OffsetExp
selOffset Select
sel)
[(TableAlias, Select)]
ctes -> SelectWithG TopLevelCTE -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SelectWithG TopLevelCTE -> Builder)
-> SelectWithG TopLevelCTE -> Builder
forall a b. (a -> b) -> a -> b
$ [(TableAlias, TopLevelCTE)] -> Select -> SelectWithG TopLevelCTE
forall statement.
[(TableAlias, statement)] -> Select -> SelectWithG statement
SelectWith (((TableAlias, Select) -> (TableAlias, TopLevelCTE))
-> [(TableAlias, Select)] -> [(TableAlias, TopLevelCTE)]
forall a b. (a -> b) -> [a] -> [b]
map (Select -> TopLevelCTE
CTESelect (Select -> TopLevelCTE)
-> (TableAlias, Select) -> (TableAlias, TopLevelCTE)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>) [(TableAlias, Select)]
ctes) Select
sel {selCTEs :: [(TableAlias, Select)]
selCTEs = []}
mkSIdenExp :: (IsIdentifier a) => a -> SQLExp
mkSIdenExp :: a -> SQLExp
mkSIdenExp = Identifier -> SQLExp
SEIdentifier (Identifier -> SQLExp) -> (a -> Identifier) -> a -> SQLExp
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier
mkQIdenExp :: (IsIdentifier a, IsIdentifier b) => a -> b -> SQLExp
mkQIdenExp :: a -> b -> SQLExp
mkQIdenExp a
q b
t = QIdentifier -> SQLExp
SEQIdentifier (QIdentifier -> SQLExp) -> QIdentifier -> SQLExp
forall a b. (a -> b) -> a -> b
$ a -> b -> QIdentifier
forall a b.
(IsIdentifier a, IsIdentifier b) =>
a -> b -> QIdentifier
mkQIdentifier a
q b
t
data Qual
= QualifiedIdentifier Identifier (Maybe TypeAnn)
| QualTable QualifiedTable
| QualVar Text
deriving (Int -> Qual -> ShowS
[Qual] -> ShowS
Qual -> String
(Int -> Qual -> ShowS)
-> (Qual -> String) -> ([Qual] -> ShowS) -> Show Qual
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Qual] -> ShowS
$cshowList :: [Qual] -> ShowS
show :: Qual -> String
$cshow :: Qual -> String
showsPrec :: Int -> Qual -> ShowS
$cshowsPrec :: Int -> Qual -> ShowS
Show, Qual -> Qual -> Bool
(Qual -> Qual -> Bool) -> (Qual -> Qual -> Bool) -> Eq Qual
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Qual -> Qual -> Bool
$c/= :: Qual -> Qual -> Bool
== :: Qual -> Qual -> Bool
$c== :: Qual -> Qual -> Bool
Eq, (forall x. Qual -> Rep Qual x)
-> (forall x. Rep Qual x -> Qual) -> Generic Qual
forall x. Rep Qual x -> Qual
forall x. Qual -> Rep Qual x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Qual x -> Qual
$cfrom :: forall x. Qual -> Rep Qual x
Generic, Typeable Qual
DataType
Constr
Typeable Qual
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Qual -> c Qual)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Qual)
-> (Qual -> Constr)
-> (Qual -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Qual))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Qual))
-> ((forall b. Data b => b -> b) -> Qual -> Qual)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Qual -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Qual -> r)
-> (forall u. (forall d. Data d => d -> u) -> Qual -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Qual -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Qual -> m Qual)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Qual -> m Qual)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Qual -> m Qual)
-> Data Qual
Qual -> DataType
Qual -> Constr
(forall b. Data b => b -> b) -> Qual -> Qual
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Qual -> c Qual
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Qual
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Qual -> u
forall u. (forall d. Data d => d -> u) -> Qual -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Qual -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Qual -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Qual -> m Qual
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Qual -> m Qual
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Qual
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Qual -> c Qual
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Qual)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Qual)
$cQualVar :: Constr
$cQualTable :: Constr
$cQualifiedIdentifier :: Constr
$tQual :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Qual -> m Qual
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Qual -> m Qual
gmapMp :: (forall d. Data d => d -> m d) -> Qual -> m Qual
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Qual -> m Qual
gmapM :: (forall d. Data d => d -> m d) -> Qual -> m Qual
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Qual -> m Qual
gmapQi :: Int -> (forall d. Data d => d -> u) -> Qual -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Qual -> u
gmapQ :: (forall d. Data d => d -> u) -> Qual -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Qual -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Qual -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Qual -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Qual -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Qual -> r
gmapT :: (forall b. Data b => b -> b) -> Qual -> Qual
$cgmapT :: (forall b. Data b => b -> b) -> Qual -> Qual
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Qual)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Qual)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Qual)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Qual)
dataTypeOf :: Qual -> DataType
$cdataTypeOf :: Qual -> DataType
toConstr :: Qual -> Constr
$ctoConstr :: Qual -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Qual
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Qual
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Qual -> c Qual
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Qual -> c Qual
$cp1Data :: Typeable Qual
Data)
instance NFData Qual
instance Cacheable Qual
instance Hashable Qual
mkQual :: QualifiedTable -> Qual
mkQual :: QualifiedTable -> Qual
mkQual = QualifiedTable -> Qual
QualTable
instance ToSQL Qual where
toSQL :: Qual -> Builder
toSQL (QualifiedIdentifier Identifier
i Maybe TypeAnn
Nothing) = Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL Identifier
i
toSQL (QualifiedIdentifier Identifier
i (Just TypeAnn
ty)) = Builder -> Builder
parenB (Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL Identifier
i Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> TypeAnn -> Builder
forall a. ToSQL a => a -> Builder
toSQL TypeAnn
ty)
toSQL (QualTable QualifiedTable
qt) = QualifiedTable -> Builder
forall a. ToSQL a => a -> Builder
toSQL QualifiedTable
qt
toSQL (QualVar Text
v) = Text -> Builder
TB.text Text
v
mkQIdentifier :: (IsIdentifier a, IsIdentifier b) => a -> b -> QIdentifier
mkQIdentifier :: a -> b -> QIdentifier
mkQIdentifier a
q b
t = Qual -> Identifier -> QIdentifier
QIdentifier (Identifier -> Maybe TypeAnn -> Qual
QualifiedIdentifier (a -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier a
q) Maybe TypeAnn
forall a. Maybe a
Nothing) (b -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier b
t)
mkQIdentifierTable :: (IsIdentifier a) => QualifiedTable -> a -> QIdentifier
mkQIdentifierTable :: QualifiedTable -> a -> QIdentifier
mkQIdentifierTable QualifiedTable
q = Qual -> Identifier -> QIdentifier
QIdentifier (QualifiedTable -> Qual
mkQual QualifiedTable
q) (Identifier -> QIdentifier)
-> (a -> Identifier) -> a -> QIdentifier
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier
data QIdentifier
= QIdentifier Qual Identifier
deriving (Int -> QIdentifier -> ShowS
[QIdentifier] -> ShowS
QIdentifier -> String
(Int -> QIdentifier -> ShowS)
-> (QIdentifier -> String)
-> ([QIdentifier] -> ShowS)
-> Show QIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QIdentifier] -> ShowS
$cshowList :: [QIdentifier] -> ShowS
show :: QIdentifier -> String
$cshow :: QIdentifier -> String
showsPrec :: Int -> QIdentifier -> ShowS
$cshowsPrec :: Int -> QIdentifier -> ShowS
Show, QIdentifier -> QIdentifier -> Bool
(QIdentifier -> QIdentifier -> Bool)
-> (QIdentifier -> QIdentifier -> Bool) -> Eq QIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QIdentifier -> QIdentifier -> Bool
$c/= :: QIdentifier -> QIdentifier -> Bool
== :: QIdentifier -> QIdentifier -> Bool
$c== :: QIdentifier -> QIdentifier -> Bool
Eq, (forall x. QIdentifier -> Rep QIdentifier x)
-> (forall x. Rep QIdentifier x -> QIdentifier)
-> Generic QIdentifier
forall x. Rep QIdentifier x -> QIdentifier
forall x. QIdentifier -> Rep QIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QIdentifier x -> QIdentifier
$cfrom :: forall x. QIdentifier -> Rep QIdentifier x
Generic, Typeable QIdentifier
DataType
Constr
Typeable QIdentifier
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QIdentifier -> c QIdentifier)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QIdentifier)
-> (QIdentifier -> Constr)
-> (QIdentifier -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c QIdentifier))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c QIdentifier))
-> ((forall b. Data b => b -> b) -> QIdentifier -> QIdentifier)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> QIdentifier -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> QIdentifier -> r)
-> (forall u. (forall d. Data d => d -> u) -> QIdentifier -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> QIdentifier -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier)
-> Data QIdentifier
QIdentifier -> DataType
QIdentifier -> Constr
(forall b. Data b => b -> b) -> QIdentifier -> QIdentifier
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QIdentifier -> c QIdentifier
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QIdentifier
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> QIdentifier -> u
forall u. (forall d. Data d => d -> u) -> QIdentifier -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> QIdentifier -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> QIdentifier -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QIdentifier
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QIdentifier -> c QIdentifier
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c QIdentifier)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c QIdentifier)
$cQIdentifier :: Constr
$tQIdentifier :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier
gmapMp :: (forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier
gmapM :: (forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> QIdentifier -> m QIdentifier
gmapQi :: Int -> (forall d. Data d => d -> u) -> QIdentifier -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> QIdentifier -> u
gmapQ :: (forall d. Data d => d -> u) -> QIdentifier -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> QIdentifier -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> QIdentifier -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> QIdentifier -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> QIdentifier -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> QIdentifier -> r
gmapT :: (forall b. Data b => b -> b) -> QIdentifier -> QIdentifier
$cgmapT :: (forall b. Data b => b -> b) -> QIdentifier -> QIdentifier
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c QIdentifier)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c QIdentifier)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c QIdentifier)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c QIdentifier)
dataTypeOf :: QIdentifier -> DataType
$cdataTypeOf :: QIdentifier -> DataType
toConstr :: QIdentifier -> Constr
$ctoConstr :: QIdentifier -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QIdentifier
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c QIdentifier
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QIdentifier -> c QIdentifier
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> QIdentifier -> c QIdentifier
$cp1Data :: Typeable QIdentifier
Data)
instance NFData QIdentifier
instance Cacheable QIdentifier
instance Hashable QIdentifier
instance ToSQL QIdentifier where
toSQL :: QIdentifier -> Builder
toSQL (QIdentifier Qual
qual Identifier
iden) =
[Builder] -> Builder
forall a. Monoid a => [a] -> a
mconcat [Qual -> Builder
forall a. ToSQL a => a -> Builder
toSQL Qual
qual, Char -> Builder
TB.char Char
'.', Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL Identifier
iden]
data ColumnOp = ColumnOp
{ ColumnOp -> SQLOp
_colOp :: SQLOp,
ColumnOp -> SQLExp
_colExp :: SQLExp
}
deriving (Int -> ColumnOp -> ShowS
[ColumnOp] -> ShowS
ColumnOp -> String
(Int -> ColumnOp -> ShowS)
-> (ColumnOp -> String) -> ([ColumnOp] -> ShowS) -> Show ColumnOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColumnOp] -> ShowS
$cshowList :: [ColumnOp] -> ShowS
show :: ColumnOp -> String
$cshow :: ColumnOp -> String
showsPrec :: Int -> ColumnOp -> ShowS
$cshowsPrec :: Int -> ColumnOp -> ShowS
Show, ColumnOp -> ColumnOp -> Bool
(ColumnOp -> ColumnOp -> Bool)
-> (ColumnOp -> ColumnOp -> Bool) -> Eq ColumnOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnOp -> ColumnOp -> Bool
$c/= :: ColumnOp -> ColumnOp -> Bool
== :: ColumnOp -> ColumnOp -> Bool
$c== :: ColumnOp -> ColumnOp -> Bool
Eq, (forall x. ColumnOp -> Rep ColumnOp x)
-> (forall x. Rep ColumnOp x -> ColumnOp) -> Generic ColumnOp
forall x. Rep ColumnOp x -> ColumnOp
forall x. ColumnOp -> Rep ColumnOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ColumnOp x -> ColumnOp
$cfrom :: forall x. ColumnOp -> Rep ColumnOp x
Generic, Typeable ColumnOp
DataType
Constr
Typeable ColumnOp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnOp -> c ColumnOp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnOp)
-> (ColumnOp -> Constr)
-> (ColumnOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ColumnOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ColumnOp))
-> ((forall b. Data b => b -> b) -> ColumnOp -> ColumnOp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnOp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> ColumnOp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> ColumnOp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp)
-> Data ColumnOp
ColumnOp -> DataType
ColumnOp -> Constr
(forall b. Data b => b -> b) -> ColumnOp -> ColumnOp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnOp -> c ColumnOp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnOp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ColumnOp -> u
forall u. (forall d. Data d => d -> u) -> ColumnOp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnOp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnOp -> c ColumnOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ColumnOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ColumnOp)
$cColumnOp :: Constr
$tColumnOp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp
gmapMp :: (forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp
gmapM :: (forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ColumnOp -> m ColumnOp
gmapQi :: Int -> (forall d. Data d => d -> u) -> ColumnOp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ColumnOp -> u
gmapQ :: (forall d. Data d => d -> u) -> ColumnOp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ColumnOp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnOp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnOp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnOp -> r
gmapT :: (forall b. Data b => b -> b) -> ColumnOp -> ColumnOp
$cgmapT :: (forall b. Data b => b -> b) -> ColumnOp -> ColumnOp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ColumnOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ColumnOp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ColumnOp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ColumnOp)
dataTypeOf :: ColumnOp -> DataType
$cdataTypeOf :: ColumnOp -> DataType
toConstr :: ColumnOp -> Constr
$ctoConstr :: ColumnOp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnOp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnOp -> c ColumnOp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnOp -> c ColumnOp
$cp1Data :: Typeable ColumnOp
Data)
instance NFData ColumnOp
instance Cacheable ColumnOp
instance Hashable ColumnOp
newtype SQLOp = SQLOp {SQLOp -> Text
sqlOpTxt :: Text}
deriving (Int -> SQLOp -> ShowS
[SQLOp] -> ShowS
SQLOp -> String
(Int -> SQLOp -> ShowS)
-> (SQLOp -> String) -> ([SQLOp] -> ShowS) -> Show SQLOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SQLOp] -> ShowS
$cshowList :: [SQLOp] -> ShowS
show :: SQLOp -> String
$cshow :: SQLOp -> String
showsPrec :: Int -> SQLOp -> ShowS
$cshowsPrec :: Int -> SQLOp -> ShowS
Show, SQLOp -> SQLOp -> Bool
(SQLOp -> SQLOp -> Bool) -> (SQLOp -> SQLOp -> Bool) -> Eq SQLOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SQLOp -> SQLOp -> Bool
$c/= :: SQLOp -> SQLOp -> Bool
== :: SQLOp -> SQLOp -> Bool
$c== :: SQLOp -> SQLOp -> Bool
Eq, SQLOp -> ()
(SQLOp -> ()) -> NFData SQLOp
forall a. (a -> ()) -> NFData a
rnf :: SQLOp -> ()
$crnf :: SQLOp -> ()
NFData, Typeable SQLOp
DataType
Constr
Typeable SQLOp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLOp -> c SQLOp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLOp)
-> (SQLOp -> Constr)
-> (SQLOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SQLOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SQLOp))
-> ((forall b. Data b => b -> b) -> SQLOp -> SQLOp)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SQLOp -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SQLOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> SQLOp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> SQLOp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SQLOp -> m SQLOp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLOp -> m SQLOp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLOp -> m SQLOp)
-> Data SQLOp
SQLOp -> DataType
SQLOp -> Constr
(forall b. Data b => b -> b) -> SQLOp -> SQLOp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLOp -> c SQLOp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLOp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> SQLOp -> u
forall u. (forall d. Data d => d -> u) -> SQLOp -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SQLOp -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SQLOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SQLOp -> m SQLOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLOp -> m SQLOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLOp -> c SQLOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SQLOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SQLOp)
$cSQLOp :: Constr
$tSQLOp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> SQLOp -> m SQLOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLOp -> m SQLOp
gmapMp :: (forall d. Data d => d -> m d) -> SQLOp -> m SQLOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLOp -> m SQLOp
gmapM :: (forall d. Data d => d -> m d) -> SQLOp -> m SQLOp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SQLOp -> m SQLOp
gmapQi :: Int -> (forall d. Data d => d -> u) -> SQLOp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SQLOp -> u
gmapQ :: (forall d. Data d => d -> u) -> SQLOp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SQLOp -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SQLOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SQLOp -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SQLOp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SQLOp -> r
gmapT :: (forall b. Data b => b -> b) -> SQLOp -> SQLOp
$cgmapT :: (forall b. Data b => b -> b) -> SQLOp -> SQLOp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SQLOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SQLOp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c SQLOp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SQLOp)
dataTypeOf :: SQLOp -> DataType
$cdataTypeOf :: SQLOp -> DataType
toConstr :: SQLOp -> Constr
$ctoConstr :: SQLOp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLOp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLOp -> c SQLOp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLOp -> c SQLOp
$cp1Data :: Typeable SQLOp
Data, Eq SQLOp
Eq SQLOp -> (Accesses -> SQLOp -> SQLOp -> Bool) -> Cacheable SQLOp
Accesses -> SQLOp -> SQLOp -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> SQLOp -> SQLOp -> Bool
$cunchanged :: Accesses -> SQLOp -> SQLOp -> Bool
$cp1Cacheable :: Eq SQLOp
Cacheable, Int -> SQLOp -> Int
SQLOp -> Int
(Int -> SQLOp -> Int) -> (SQLOp -> Int) -> Hashable SQLOp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: SQLOp -> Int
$chash :: SQLOp -> Int
hashWithSalt :: Int -> SQLOp -> Int
$chashWithSalt :: Int -> SQLOp -> Int
Hashable)
incOp :: SQLOp
incOp :: SQLOp
incOp = Text -> SQLOp
SQLOp Text
"+"
mulOp :: SQLOp
mulOp :: SQLOp
mulOp = Text -> SQLOp
SQLOp Text
"*"
jsonbPathOp :: SQLOp
jsonbPathOp :: SQLOp
jsonbPathOp = Text -> SQLOp
SQLOp Text
"#>"
jsonbConcatOp :: SQLOp
jsonbConcatOp :: SQLOp
jsonbConcatOp = Text -> SQLOp
SQLOp Text
"||"
jsonbDeleteOp :: SQLOp
jsonbDeleteOp :: SQLOp
jsonbDeleteOp = Text -> SQLOp
SQLOp Text
"-"
jsonbDeleteAtPathOp :: SQLOp
jsonbDeleteAtPathOp :: SQLOp
jsonbDeleteAtPathOp = Text -> SQLOp
SQLOp Text
"#-"
newtype TypeAnn = TypeAnn {TypeAnn -> Text
unTypeAnn :: Text}
deriving (Int -> TypeAnn -> ShowS
[TypeAnn] -> ShowS
TypeAnn -> String
(Int -> TypeAnn -> ShowS)
-> (TypeAnn -> String) -> ([TypeAnn] -> ShowS) -> Show TypeAnn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TypeAnn] -> ShowS
$cshowList :: [TypeAnn] -> ShowS
show :: TypeAnn -> String
$cshow :: TypeAnn -> String
showsPrec :: Int -> TypeAnn -> ShowS
$cshowsPrec :: Int -> TypeAnn -> ShowS
Show, TypeAnn -> TypeAnn -> Bool
(TypeAnn -> TypeAnn -> Bool)
-> (TypeAnn -> TypeAnn -> Bool) -> Eq TypeAnn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TypeAnn -> TypeAnn -> Bool
$c/= :: TypeAnn -> TypeAnn -> Bool
== :: TypeAnn -> TypeAnn -> Bool
$c== :: TypeAnn -> TypeAnn -> Bool
Eq, TypeAnn -> ()
(TypeAnn -> ()) -> NFData TypeAnn
forall a. (a -> ()) -> NFData a
rnf :: TypeAnn -> ()
$crnf :: TypeAnn -> ()
NFData, Typeable TypeAnn
DataType
Constr
Typeable TypeAnn
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeAnn -> c TypeAnn)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeAnn)
-> (TypeAnn -> Constr)
-> (TypeAnn -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeAnn))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeAnn))
-> ((forall b. Data b => b -> b) -> TypeAnn -> TypeAnn)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeAnn -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeAnn -> r)
-> (forall u. (forall d. Data d => d -> u) -> TypeAnn -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> TypeAnn -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn)
-> Data TypeAnn
TypeAnn -> DataType
TypeAnn -> Constr
(forall b. Data b => b -> b) -> TypeAnn -> TypeAnn
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeAnn -> c TypeAnn
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeAnn
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TypeAnn -> u
forall u. (forall d. Data d => d -> u) -> TypeAnn -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeAnn -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeAnn -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeAnn
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeAnn -> c TypeAnn
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeAnn)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeAnn)
$cTypeAnn :: Constr
$tTypeAnn :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn
gmapMp :: (forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn
gmapM :: (forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TypeAnn -> m TypeAnn
gmapQi :: Int -> (forall d. Data d => d -> u) -> TypeAnn -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TypeAnn -> u
gmapQ :: (forall d. Data d => d -> u) -> TypeAnn -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TypeAnn -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeAnn -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TypeAnn -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeAnn -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TypeAnn -> r
gmapT :: (forall b. Data b => b -> b) -> TypeAnn -> TypeAnn
$cgmapT :: (forall b. Data b => b -> b) -> TypeAnn -> TypeAnn
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeAnn)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeAnn)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c TypeAnn)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TypeAnn)
dataTypeOf :: TypeAnn -> DataType
$cdataTypeOf :: TypeAnn -> DataType
toConstr :: TypeAnn -> Constr
$ctoConstr :: TypeAnn -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeAnn
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TypeAnn
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeAnn -> c TypeAnn
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TypeAnn -> c TypeAnn
$cp1Data :: Typeable TypeAnn
Data, Eq TypeAnn
Eq TypeAnn
-> (Accesses -> TypeAnn -> TypeAnn -> Bool) -> Cacheable TypeAnn
Accesses -> TypeAnn -> TypeAnn -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> TypeAnn -> TypeAnn -> Bool
$cunchanged :: Accesses -> TypeAnn -> TypeAnn -> Bool
$cp1Cacheable :: Eq TypeAnn
Cacheable, Int -> TypeAnn -> Int
TypeAnn -> Int
(Int -> TypeAnn -> Int) -> (TypeAnn -> Int) -> Hashable TypeAnn
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: TypeAnn -> Int
$chash :: TypeAnn -> Int
hashWithSalt :: Int -> TypeAnn -> Int
$chashWithSalt :: Int -> TypeAnn -> Int
Hashable)
instance ToSQL TypeAnn where
toSQL :: TypeAnn -> Builder
toSQL (TypeAnn Text
ty) = Builder
"::" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Text -> Builder
TB.text Text
ty
mkTypeAnn :: CollectableType PGScalarType -> TypeAnn
mkTypeAnn :: CollectableType PGScalarType -> TypeAnn
mkTypeAnn = Text -> TypeAnn
TypeAnn (Text -> TypeAnn)
-> (CollectableType PGScalarType -> Text)
-> CollectableType PGScalarType
-> TypeAnn
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CollectableType PGScalarType -> Text
forall a. ToSQL a => a -> Text
toSQLTxt
intTypeAnn :: TypeAnn
intTypeAnn :: TypeAnn
intTypeAnn = CollectableType PGScalarType -> TypeAnn
mkTypeAnn (CollectableType PGScalarType -> TypeAnn)
-> CollectableType PGScalarType -> TypeAnn
forall a b. (a -> b) -> a -> b
$ PGScalarType -> CollectableType PGScalarType
forall a. a -> CollectableType a
CollectableTypeScalar PGScalarType
PGInteger
numericTypeAnn :: TypeAnn
numericTypeAnn :: TypeAnn
numericTypeAnn = CollectableType PGScalarType -> TypeAnn
mkTypeAnn (CollectableType PGScalarType -> TypeAnn)
-> CollectableType PGScalarType -> TypeAnn
forall a b. (a -> b) -> a -> b
$ PGScalarType -> CollectableType PGScalarType
forall a. a -> CollectableType a
CollectableTypeScalar PGScalarType
PGNumeric
textTypeAnn :: TypeAnn
textTypeAnn :: TypeAnn
textTypeAnn = CollectableType PGScalarType -> TypeAnn
mkTypeAnn (CollectableType PGScalarType -> TypeAnn)
-> CollectableType PGScalarType -> TypeAnn
forall a b. (a -> b) -> a -> b
$ PGScalarType -> CollectableType PGScalarType
forall a. a -> CollectableType a
CollectableTypeScalar PGScalarType
PGText
textArrTypeAnn :: TypeAnn
textArrTypeAnn :: TypeAnn
textArrTypeAnn = CollectableType PGScalarType -> TypeAnn
mkTypeAnn (CollectableType PGScalarType -> TypeAnn)
-> CollectableType PGScalarType -> TypeAnn
forall a b. (a -> b) -> a -> b
$ PGScalarType -> CollectableType PGScalarType
forall a. a -> CollectableType a
CollectableTypeArray PGScalarType
PGText
jsonTypeAnn :: TypeAnn
jsonTypeAnn :: TypeAnn
jsonTypeAnn = CollectableType PGScalarType -> TypeAnn
mkTypeAnn (CollectableType PGScalarType -> TypeAnn)
-> CollectableType PGScalarType -> TypeAnn
forall a b. (a -> b) -> a -> b
$ PGScalarType -> CollectableType PGScalarType
forall a. a -> CollectableType a
CollectableTypeScalar PGScalarType
PGJSON
jsonbTypeAnn :: TypeAnn
jsonbTypeAnn :: TypeAnn
jsonbTypeAnn = CollectableType PGScalarType -> TypeAnn
mkTypeAnn (CollectableType PGScalarType -> TypeAnn)
-> CollectableType PGScalarType -> TypeAnn
forall a b. (a -> b) -> a -> b
$ PGScalarType -> CollectableType PGScalarType
forall a. a -> CollectableType a
CollectableTypeScalar PGScalarType
PGJSONB
boolTypeAnn :: TypeAnn
boolTypeAnn :: TypeAnn
boolTypeAnn = CollectableType PGScalarType -> TypeAnn
mkTypeAnn (CollectableType PGScalarType -> TypeAnn)
-> CollectableType PGScalarType -> TypeAnn
forall a b. (a -> b) -> a -> b
$ PGScalarType -> CollectableType PGScalarType
forall a. a -> CollectableType a
CollectableTypeScalar PGScalarType
PGBoolean
data CountType
= CTStar
| CTSimple [PGCol]
| CTDistinct [PGCol]
deriving (Int -> CountType -> ShowS
[CountType] -> ShowS
CountType -> String
(Int -> CountType -> ShowS)
-> (CountType -> String)
-> ([CountType] -> ShowS)
-> Show CountType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CountType] -> ShowS
$cshowList :: [CountType] -> ShowS
show :: CountType -> String
$cshow :: CountType -> String
showsPrec :: Int -> CountType -> ShowS
$cshowsPrec :: Int -> CountType -> ShowS
Show, CountType -> CountType -> Bool
(CountType -> CountType -> Bool)
-> (CountType -> CountType -> Bool) -> Eq CountType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CountType -> CountType -> Bool
$c/= :: CountType -> CountType -> Bool
== :: CountType -> CountType -> Bool
$c== :: CountType -> CountType -> Bool
Eq, (forall x. CountType -> Rep CountType x)
-> (forall x. Rep CountType x -> CountType) -> Generic CountType
forall x. Rep CountType x -> CountType
forall x. CountType -> Rep CountType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CountType x -> CountType
$cfrom :: forall x. CountType -> Rep CountType x
Generic, Typeable CountType
DataType
Constr
Typeable CountType
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CountType -> c CountType)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CountType)
-> (CountType -> Constr)
-> (CountType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CountType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CountType))
-> ((forall b. Data b => b -> b) -> CountType -> CountType)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CountType -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CountType -> r)
-> (forall u. (forall d. Data d => d -> u) -> CountType -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> CountType -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CountType -> m CountType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CountType -> m CountType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CountType -> m CountType)
-> Data CountType
CountType -> DataType
CountType -> Constr
(forall b. Data b => b -> b) -> CountType -> CountType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CountType -> c CountType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CountType
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CountType -> u
forall u. (forall d. Data d => d -> u) -> CountType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CountType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CountType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CountType -> m CountType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CountType -> m CountType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CountType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CountType -> c CountType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CountType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CountType)
$cCTDistinct :: Constr
$cCTSimple :: Constr
$cCTStar :: Constr
$tCountType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> CountType -> m CountType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CountType -> m CountType
gmapMp :: (forall d. Data d => d -> m d) -> CountType -> m CountType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CountType -> m CountType
gmapM :: (forall d. Data d => d -> m d) -> CountType -> m CountType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CountType -> m CountType
gmapQi :: Int -> (forall d. Data d => d -> u) -> CountType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CountType -> u
gmapQ :: (forall d. Data d => d -> u) -> CountType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CountType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CountType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CountType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CountType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CountType -> r
gmapT :: (forall b. Data b => b -> b) -> CountType -> CountType
$cgmapT :: (forall b. Data b => b -> b) -> CountType -> CountType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CountType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CountType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CountType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CountType)
dataTypeOf :: CountType -> DataType
$cdataTypeOf :: CountType -> DataType
toConstr :: CountType -> Constr
$ctoConstr :: CountType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CountType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CountType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CountType -> c CountType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CountType -> c CountType
$cp1Data :: Typeable CountType
Data)
instance NFData CountType
instance Cacheable CountType
instance Hashable CountType
instance ToSQL CountType where
toSQL :: CountType -> Builder
toSQL CountType
CTStar = Builder
"*"
toSQL (CTSimple [PGCol]
cols) =
Builder -> Builder
parenB (Builder -> Builder) -> Builder -> Builder
forall a b. (a -> b) -> a -> b
$ Text
", " Text -> [PGCol] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [PGCol]
cols
toSQL (CTDistinct [PGCol]
cols) =
Builder
"DISTINCT" Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (Text
", " Text -> [PGCol] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [PGCol]
cols)
newtype TupleExp
= TupleExp [SQLExp]
deriving (Int -> TupleExp -> ShowS
[TupleExp] -> ShowS
TupleExp -> String
(Int -> TupleExp -> ShowS)
-> (TupleExp -> String) -> ([TupleExp] -> ShowS) -> Show TupleExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TupleExp] -> ShowS
$cshowList :: [TupleExp] -> ShowS
show :: TupleExp -> String
$cshow :: TupleExp -> String
showsPrec :: Int -> TupleExp -> ShowS
$cshowsPrec :: Int -> TupleExp -> ShowS
Show, TupleExp -> TupleExp -> Bool
(TupleExp -> TupleExp -> Bool)
-> (TupleExp -> TupleExp -> Bool) -> Eq TupleExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TupleExp -> TupleExp -> Bool
$c/= :: TupleExp -> TupleExp -> Bool
== :: TupleExp -> TupleExp -> Bool
$c== :: TupleExp -> TupleExp -> Bool
Eq, TupleExp -> ()
(TupleExp -> ()) -> NFData TupleExp
forall a. (a -> ()) -> NFData a
rnf :: TupleExp -> ()
$crnf :: TupleExp -> ()
NFData, Typeable TupleExp
DataType
Constr
Typeable TupleExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TupleExp -> c TupleExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TupleExp)
-> (TupleExp -> Constr)
-> (TupleExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TupleExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TupleExp))
-> ((forall b. Data b => b -> b) -> TupleExp -> TupleExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TupleExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TupleExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> TupleExp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> TupleExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TupleExp -> m TupleExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TupleExp -> m TupleExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TupleExp -> m TupleExp)
-> Data TupleExp
TupleExp -> DataType
TupleExp -> Constr
(forall b. Data b => b -> b) -> TupleExp -> TupleExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TupleExp -> c TupleExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TupleExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TupleExp -> u
forall u. (forall d. Data d => d -> u) -> TupleExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TupleExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TupleExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TupleExp -> m TupleExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TupleExp -> m TupleExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TupleExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TupleExp -> c TupleExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TupleExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TupleExp)
$cTupleExp :: Constr
$tTupleExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> TupleExp -> m TupleExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TupleExp -> m TupleExp
gmapMp :: (forall d. Data d => d -> m d) -> TupleExp -> m TupleExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TupleExp -> m TupleExp
gmapM :: (forall d. Data d => d -> m d) -> TupleExp -> m TupleExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TupleExp -> m TupleExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> TupleExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TupleExp -> u
gmapQ :: (forall d. Data d => d -> u) -> TupleExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TupleExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TupleExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TupleExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TupleExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TupleExp -> r
gmapT :: (forall b. Data b => b -> b) -> TupleExp -> TupleExp
$cgmapT :: (forall b. Data b => b -> b) -> TupleExp -> TupleExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TupleExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TupleExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c TupleExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TupleExp)
dataTypeOf :: TupleExp -> DataType
$cdataTypeOf :: TupleExp -> DataType
toConstr :: TupleExp -> Constr
$ctoConstr :: TupleExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TupleExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TupleExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TupleExp -> c TupleExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TupleExp -> c TupleExp
$cp1Data :: Typeable TupleExp
Data, Eq TupleExp
Eq TupleExp
-> (Accesses -> TupleExp -> TupleExp -> Bool) -> Cacheable TupleExp
Accesses -> TupleExp -> TupleExp -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> TupleExp -> TupleExp -> Bool
$cunchanged :: Accesses -> TupleExp -> TupleExp -> Bool
$cp1Cacheable :: Eq TupleExp
Cacheable, Int -> TupleExp -> Int
TupleExp -> Int
(Int -> TupleExp -> Int) -> (TupleExp -> Int) -> Hashable TupleExp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: TupleExp -> Int
$chash :: TupleExp -> Int
hashWithSalt :: Int -> TupleExp -> Int
$chashWithSalt :: Int -> TupleExp -> Int
Hashable)
instance ToSQL TupleExp where
toSQL :: TupleExp -> Builder
toSQL (TupleExp [SQLExp]
exps) =
Builder -> Builder
parenB (Builder -> Builder) -> Builder -> Builder
forall a b. (a -> b) -> a -> b
$ Text
", " Text -> [SQLExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [SQLExp]
exps
data SQLExp
= SEPrep Int
| SENull
| SELit Text
| SEUnsafe Text
| SESelect Select
|
SEStar (Maybe Qual)
|
SEIdentifier Identifier
|
SERowIdentifier Identifier
|
SEQIdentifier QIdentifier
|
SEFnApp Text [SQLExp] (Maybe OrderByExp)
| SEOpApp SQLOp [SQLExp]
| SETyAnn SQLExp TypeAnn
| SECond BoolExp SQLExp SQLExp
| SEBool BoolExp
| SEExcluded Identifier
| SEArray [SQLExp]
| SEArrayIndex SQLExp SQLExp
| SETuple TupleExp
| SECount CountType
| SENamedArg Identifier SQLExp
| SEFunction FunctionExp
deriving (Int -> SQLExp -> ShowS
[SQLExp] -> ShowS
SQLExp -> String
(Int -> SQLExp -> ShowS)
-> (SQLExp -> String) -> ([SQLExp] -> ShowS) -> Show SQLExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SQLExp] -> ShowS
$cshowList :: [SQLExp] -> ShowS
show :: SQLExp -> String
$cshow :: SQLExp -> String
showsPrec :: Int -> SQLExp -> ShowS
$cshowsPrec :: Int -> SQLExp -> ShowS
Show, SQLExp -> SQLExp -> Bool
(SQLExp -> SQLExp -> Bool)
-> (SQLExp -> SQLExp -> Bool) -> Eq SQLExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SQLExp -> SQLExp -> Bool
$c/= :: SQLExp -> SQLExp -> Bool
== :: SQLExp -> SQLExp -> Bool
$c== :: SQLExp -> SQLExp -> Bool
Eq, (forall x. SQLExp -> Rep SQLExp x)
-> (forall x. Rep SQLExp x -> SQLExp) -> Generic SQLExp
forall x. Rep SQLExp x -> SQLExp
forall x. SQLExp -> Rep SQLExp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SQLExp x -> SQLExp
$cfrom :: forall x. SQLExp -> Rep SQLExp x
Generic, Typeable SQLExp
DataType
Constr
Typeable SQLExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLExp -> c SQLExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLExp)
-> (SQLExp -> Constr)
-> (SQLExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SQLExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SQLExp))
-> ((forall b. Data b => b -> b) -> SQLExp -> SQLExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SQLExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SQLExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> SQLExp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> SQLExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SQLExp -> m SQLExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLExp -> m SQLExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLExp -> m SQLExp)
-> Data SQLExp
SQLExp -> DataType
SQLExp -> Constr
(forall b. Data b => b -> b) -> SQLExp -> SQLExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLExp -> c SQLExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> SQLExp -> u
forall u. (forall d. Data d => d -> u) -> SQLExp -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SQLExp -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SQLExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SQLExp -> m SQLExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLExp -> m SQLExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLExp -> c SQLExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SQLExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SQLExp)
$cSEFunction :: Constr
$cSENamedArg :: Constr
$cSECount :: Constr
$cSETuple :: Constr
$cSEArrayIndex :: Constr
$cSEArray :: Constr
$cSEExcluded :: Constr
$cSEBool :: Constr
$cSECond :: Constr
$cSETyAnn :: Constr
$cSEOpApp :: Constr
$cSEFnApp :: Constr
$cSEQIdentifier :: Constr
$cSERowIdentifier :: Constr
$cSEIdentifier :: Constr
$cSEStar :: Constr
$cSESelect :: Constr
$cSEUnsafe :: Constr
$cSELit :: Constr
$cSENull :: Constr
$cSEPrep :: Constr
$tSQLExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> SQLExp -> m SQLExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLExp -> m SQLExp
gmapMp :: (forall d. Data d => d -> m d) -> SQLExp -> m SQLExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> SQLExp -> m SQLExp
gmapM :: (forall d. Data d => d -> m d) -> SQLExp -> m SQLExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> SQLExp -> m SQLExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> SQLExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> SQLExp -> u
gmapQ :: (forall d. Data d => d -> u) -> SQLExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> SQLExp -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SQLExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SQLExp -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SQLExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SQLExp -> r
gmapT :: (forall b. Data b => b -> b) -> SQLExp -> SQLExp
$cgmapT :: (forall b. Data b => b -> b) -> SQLExp -> SQLExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SQLExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SQLExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c SQLExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c SQLExp)
dataTypeOf :: SQLExp -> DataType
$cdataTypeOf :: SQLExp -> DataType
toConstr :: SQLExp -> Constr
$ctoConstr :: SQLExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c SQLExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLExp -> c SQLExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> SQLExp -> c SQLExp
$cp1Data :: Typeable SQLExp
Data)
instance NFData SQLExp
instance Cacheable SQLExp
instance Hashable SQLExp
instance J.ToJSON SQLExp where
toJSON :: SQLExp -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
J.toJSON (Text -> Value) -> (SQLExp -> Text) -> SQLExp -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SQLExp -> Text
forall a. ToSQL a => a -> Text
toSQLTxt
newtype ColumnAlias = ColumnAlias {ColumnAlias -> Identifier
getColumnAlias :: Identifier}
deriving (Int -> ColumnAlias -> ShowS
[ColumnAlias] -> ShowS
ColumnAlias -> String
(Int -> ColumnAlias -> ShowS)
-> (ColumnAlias -> String)
-> ([ColumnAlias] -> ShowS)
-> Show ColumnAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ColumnAlias] -> ShowS
$cshowList :: [ColumnAlias] -> ShowS
show :: ColumnAlias -> String
$cshow :: ColumnAlias -> String
showsPrec :: Int -> ColumnAlias -> ShowS
$cshowsPrec :: Int -> ColumnAlias -> ShowS
Show, ColumnAlias -> ColumnAlias -> Bool
(ColumnAlias -> ColumnAlias -> Bool)
-> (ColumnAlias -> ColumnAlias -> Bool) -> Eq ColumnAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ColumnAlias -> ColumnAlias -> Bool
$c/= :: ColumnAlias -> ColumnAlias -> Bool
== :: ColumnAlias -> ColumnAlias -> Bool
$c== :: ColumnAlias -> ColumnAlias -> Bool
Eq, ColumnAlias -> ()
(ColumnAlias -> ()) -> NFData ColumnAlias
forall a. (a -> ()) -> NFData a
rnf :: ColumnAlias -> ()
$crnf :: ColumnAlias -> ()
NFData, Typeable ColumnAlias
DataType
Constr
Typeable ColumnAlias
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnAlias -> c ColumnAlias)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnAlias)
-> (ColumnAlias -> Constr)
-> (ColumnAlias -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ColumnAlias))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ColumnAlias))
-> ((forall b. Data b => b -> b) -> ColumnAlias -> ColumnAlias)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnAlias -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnAlias -> r)
-> (forall u. (forall d. Data d => d -> u) -> ColumnAlias -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ColumnAlias -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias)
-> Data ColumnAlias
ColumnAlias -> DataType
ColumnAlias -> Constr
(forall b. Data b => b -> b) -> ColumnAlias -> ColumnAlias
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnAlias -> c ColumnAlias
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnAlias
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ColumnAlias -> u
forall u. (forall d. Data d => d -> u) -> ColumnAlias -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnAlias -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnAlias -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnAlias
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnAlias -> c ColumnAlias
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ColumnAlias)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ColumnAlias)
$cColumnAlias :: Constr
$tColumnAlias :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias
gmapMp :: (forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias
gmapM :: (forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ColumnAlias -> m ColumnAlias
gmapQi :: Int -> (forall d. Data d => d -> u) -> ColumnAlias -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ColumnAlias -> u
gmapQ :: (forall d. Data d => d -> u) -> ColumnAlias -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ColumnAlias -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnAlias -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnAlias -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnAlias -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ColumnAlias -> r
gmapT :: (forall b. Data b => b -> b) -> ColumnAlias -> ColumnAlias
$cgmapT :: (forall b. Data b => b -> b) -> ColumnAlias -> ColumnAlias
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ColumnAlias)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c ColumnAlias)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ColumnAlias)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ColumnAlias)
dataTypeOf :: ColumnAlias -> DataType
$cdataTypeOf :: ColumnAlias -> DataType
toConstr :: ColumnAlias -> Constr
$ctoConstr :: ColumnAlias -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnAlias
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ColumnAlias
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnAlias -> c ColumnAlias
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ColumnAlias -> c ColumnAlias
$cp1Data :: Typeable ColumnAlias
Data, Eq ColumnAlias
Eq ColumnAlias
-> (Accesses -> ColumnAlias -> ColumnAlias -> Bool)
-> Cacheable ColumnAlias
Accesses -> ColumnAlias -> ColumnAlias -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> ColumnAlias -> ColumnAlias -> Bool
$cunchanged :: Accesses -> ColumnAlias -> ColumnAlias -> Bool
$cp1Cacheable :: Eq ColumnAlias
Cacheable, Int -> ColumnAlias -> Int
ColumnAlias -> Int
(Int -> ColumnAlias -> Int)
-> (ColumnAlias -> Int) -> Hashable ColumnAlias
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ColumnAlias -> Int
$chash :: ColumnAlias -> Int
hashWithSalt :: Int -> ColumnAlias -> Int
$chashWithSalt :: Int -> ColumnAlias -> Int
Hashable)
instance IsIdentifier ColumnAlias where
toIdentifier :: ColumnAlias -> Identifier
toIdentifier (ColumnAlias Identifier
identifier) = Identifier
identifier
toColumnAlias :: (IsIdentifier a) => a -> ColumnAlias
toColumnAlias :: a -> ColumnAlias
toColumnAlias = Identifier -> ColumnAlias
ColumnAlias (Identifier -> ColumnAlias)
-> (a -> Identifier) -> a -> ColumnAlias
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier
columnAliasToSqlWithAs :: ColumnAlias -> TB.Builder
columnAliasToSqlWithAs :: ColumnAlias -> Builder
columnAliasToSqlWithAs (ColumnAlias Identifier
alias) = Builder
"AS" Builder -> Builder -> Builder
<~> Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL Identifier
alias
columnAliasToSqlWithoutAs :: ColumnAlias -> TB.Builder
columnAliasToSqlWithoutAs :: ColumnAlias -> Builder
columnAliasToSqlWithoutAs ColumnAlias
alias = Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL (ColumnAlias -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier ColumnAlias
alias)
newtype TableAlias = TableAlias {TableAlias -> Identifier
getTableAlias :: Identifier}
deriving (Int -> TableAlias -> ShowS
[TableAlias] -> ShowS
TableAlias -> String
(Int -> TableAlias -> ShowS)
-> (TableAlias -> String)
-> ([TableAlias] -> ShowS)
-> Show TableAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TableAlias] -> ShowS
$cshowList :: [TableAlias] -> ShowS
show :: TableAlias -> String
$cshow :: TableAlias -> String
showsPrec :: Int -> TableAlias -> ShowS
$cshowsPrec :: Int -> TableAlias -> ShowS
Show, TableAlias -> TableAlias -> Bool
(TableAlias -> TableAlias -> Bool)
-> (TableAlias -> TableAlias -> Bool) -> Eq TableAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TableAlias -> TableAlias -> Bool
$c/= :: TableAlias -> TableAlias -> Bool
== :: TableAlias -> TableAlias -> Bool
$c== :: TableAlias -> TableAlias -> Bool
Eq, TableAlias -> ()
(TableAlias -> ()) -> NFData TableAlias
forall a. (a -> ()) -> NFData a
rnf :: TableAlias -> ()
$crnf :: TableAlias -> ()
NFData, Typeable TableAlias
DataType
Constr
Typeable TableAlias
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TableAlias -> c TableAlias)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TableAlias)
-> (TableAlias -> Constr)
-> (TableAlias -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TableAlias))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c TableAlias))
-> ((forall b. Data b => b -> b) -> TableAlias -> TableAlias)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TableAlias -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TableAlias -> r)
-> (forall u. (forall d. Data d => d -> u) -> TableAlias -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> TableAlias -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TableAlias -> m TableAlias)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TableAlias -> m TableAlias)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TableAlias -> m TableAlias)
-> Data TableAlias
TableAlias -> DataType
TableAlias -> Constr
(forall b. Data b => b -> b) -> TableAlias -> TableAlias
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TableAlias -> c TableAlias
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TableAlias
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> TableAlias -> u
forall u. (forall d. Data d => d -> u) -> TableAlias -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TableAlias -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TableAlias -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TableAlias -> m TableAlias
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TableAlias -> m TableAlias
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TableAlias
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TableAlias -> c TableAlias
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TableAlias)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TableAlias)
$cTableAlias :: Constr
$tTableAlias :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> TableAlias -> m TableAlias
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TableAlias -> m TableAlias
gmapMp :: (forall d. Data d => d -> m d) -> TableAlias -> m TableAlias
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> TableAlias -> m TableAlias
gmapM :: (forall d. Data d => d -> m d) -> TableAlias -> m TableAlias
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> TableAlias -> m TableAlias
gmapQi :: Int -> (forall d. Data d => d -> u) -> TableAlias -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> TableAlias -> u
gmapQ :: (forall d. Data d => d -> u) -> TableAlias -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> TableAlias -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TableAlias -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> TableAlias -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TableAlias -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> TableAlias -> r
gmapT :: (forall b. Data b => b -> b) -> TableAlias -> TableAlias
$cgmapT :: (forall b. Data b => b -> b) -> TableAlias -> TableAlias
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TableAlias)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TableAlias)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c TableAlias)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c TableAlias)
dataTypeOf :: TableAlias -> DataType
$cdataTypeOf :: TableAlias -> DataType
toConstr :: TableAlias -> Constr
$ctoConstr :: TableAlias -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TableAlias
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c TableAlias
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TableAlias -> c TableAlias
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> TableAlias -> c TableAlias
$cp1Data :: Typeable TableAlias
Data, (forall x. TableAlias -> Rep TableAlias x)
-> (forall x. Rep TableAlias x -> TableAlias) -> Generic TableAlias
forall x. Rep TableAlias x -> TableAlias
forall x. TableAlias -> Rep TableAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TableAlias x -> TableAlias
$cfrom :: forall x. TableAlias -> Rep TableAlias x
Generic, Eq TableAlias
Eq TableAlias
-> (Accesses -> TableAlias -> TableAlias -> Bool)
-> Cacheable TableAlias
Accesses -> TableAlias -> TableAlias -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> TableAlias -> TableAlias -> Bool
$cunchanged :: Accesses -> TableAlias -> TableAlias -> Bool
$cp1Cacheable :: Eq TableAlias
Cacheable, Int -> TableAlias -> Int
TableAlias -> Int
(Int -> TableAlias -> Int)
-> (TableAlias -> Int) -> Hashable TableAlias
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: TableAlias -> Int
$chash :: TableAlias -> Int
hashWithSalt :: Int -> TableAlias -> Int
$chashWithSalt :: Int -> TableAlias -> Int
Hashable)
instance IsIdentifier TableAlias where
toIdentifier :: TableAlias -> Identifier
toIdentifier (TableAlias Identifier
identifier) = Identifier
identifier
toTableAlias :: (IsIdentifier a) => a -> TableAlias
toTableAlias :: a -> TableAlias
toTableAlias = Identifier -> TableAlias
TableAlias (Identifier -> TableAlias) -> (a -> Identifier) -> a -> TableAlias
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier
tableAliasToSqlWithAs :: TableAlias -> TB.Builder
tableAliasToSqlWithAs :: TableAlias -> Builder
tableAliasToSqlWithAs TableAlias
alias = Builder
"AS" Builder -> Builder -> Builder
<~> Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL (TableAlias -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier TableAlias
alias)
tableAliasToSqlWithoutAs :: TableAlias -> TB.Builder
tableAliasToSqlWithoutAs :: TableAlias -> Builder
tableAliasToSqlWithoutAs TableAlias
alias = Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL (TableAlias -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier TableAlias
alias)
countStar :: SQLExp
countStar :: SQLExp
countStar = CountType -> SQLExp
SECount CountType
CTStar
instance ToSQL SQLExp where
toSQL :: SQLExp -> Builder
toSQL (SEPrep Int
argNumber) =
Char -> Builder
TB.char Char
'$' Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> String -> Builder
forall a. IsString a => String -> a
fromString (Int -> String
forall a. Show a => a -> String
show Int
argNumber)
toSQL SQLExp
SENull =
Text -> Builder
TB.text Text
"NULL"
toSQL (SELit Text
tv) =
Text -> Builder
TB.text (Text -> Builder) -> Text -> Builder
forall a b. (a -> b) -> a -> b
$ Text -> Text
pgFmtLit Text
tv
toSQL (SEUnsafe Text
t) =
Text -> Builder
TB.text Text
t
toSQL (SESelect Select
se) =
Builder -> Builder
parenB (Builder -> Builder) -> Builder -> Builder
forall a b. (a -> b) -> a -> b
$ Select -> Builder
forall a. ToSQL a => a -> Builder
toSQL Select
se
toSQL (SEStar Maybe Qual
Nothing) =
Char -> Builder
TB.char Char
'*'
toSQL (SEStar (Just Qual
qual)) =
[Builder] -> Builder
forall a. Monoid a => [a] -> a
mconcat [Qual -> Builder
forall a. ToSQL a => a -> Builder
toSQL Qual
qual, Char -> Builder
TB.char Char
'.', Char -> Builder
TB.char Char
'*']
toSQL (SEIdentifier Identifier
iden) =
Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL Identifier
iden
toSQL (SERowIdentifier Identifier
iden) =
Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL Identifier
iden
toSQL (SEQIdentifier QIdentifier
qIdentifier) =
QIdentifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL QIdentifier
qIdentifier
toSQL (SEFnApp Text
name [SQLExp]
args Maybe OrderByExp
mObe) =
Text -> Builder
TB.text Text
name Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> Builder
parenB ((Text
", " Text -> [SQLExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [SQLExp]
args) Builder -> Builder -> Builder
<~> Maybe OrderByExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL Maybe OrderByExp
mObe)
toSQL (SEOpApp SQLOp
op [SQLExp]
args) =
Builder -> Builder
parenB (SQLOp -> Text
sqlOpTxt SQLOp
op Text -> [SQLExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [SQLExp]
args)
toSQL (SETyAnn SQLExp
e TypeAnn
ty) =
Builder -> Builder
parenB (SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
e) Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> TypeAnn -> Builder
forall a. ToSQL a => a -> Builder
toSQL TypeAnn
ty
toSQL (SECond BoolExp
cond SQLExp
te SQLExp
fe) =
Builder
"CASE WHEN" Builder -> Builder -> Builder
<~> BoolExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL BoolExp
cond
Builder -> Builder -> Builder
<~> Builder
"THEN"
Builder -> Builder -> Builder
<~> SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
te
Builder -> Builder -> Builder
<~> Builder
"ELSE"
Builder -> Builder -> Builder
<~> SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
fe
Builder -> Builder -> Builder
<~> Builder
"END"
toSQL (SEBool BoolExp
be) = BoolExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL BoolExp
be
toSQL (SEExcluded Identifier
i) =
Builder
"EXCLUDED."
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL Identifier
i
toSQL (SEArray [SQLExp]
exps) =
Builder
"ARRAY" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Char -> Builder
TB.char Char
'['
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> (Text
", " Text -> [SQLExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [SQLExp]
exps)
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Char -> Builder
TB.char Char
']'
toSQL (SEArrayIndex SQLExp
arrayExp SQLExp
indexExp) =
Builder -> Builder
parenB (SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
arrayExp)
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Char -> Builder
TB.char Char
'['
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
indexExp
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Char -> Builder
TB.char Char
']'
toSQL (SETuple TupleExp
tup) = TupleExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL TupleExp
tup
toSQL (SECount CountType
ty) = Builder
"COUNT" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> Builder
parenB (CountType -> Builder
forall a. ToSQL a => a -> Builder
toSQL CountType
ty)
toSQL (SENamedArg Identifier
arg SQLExp
val) = Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL Identifier
arg Builder -> Builder -> Builder
<~> Builder
"=>" Builder -> Builder -> Builder
<~> SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
val
toSQL (SEFunction FunctionExp
funcExp) = FunctionExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL FunctionExp
funcExp
intToSQLExp :: Int -> SQLExp
intToSQLExp :: Int -> SQLExp
intToSQLExp = Text -> SQLExp
SEUnsafe (Text -> SQLExp) -> (Int -> Text) -> Int -> SQLExp
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Text
forall a. Show a => a -> Text
tshow
int64ToSQLExp :: Int64 -> SQLExp
int64ToSQLExp :: Int64 -> SQLExp
int64ToSQLExp = Text -> SQLExp
SEUnsafe (Text -> SQLExp) -> (Int64 -> Text) -> Int64 -> SQLExp
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int64 -> Text
forall a. Show a => a -> Text
tshow
data = SQLExp (Maybe ColumnAlias)
deriving (Int -> Extractor -> ShowS
[Extractor] -> ShowS
Extractor -> String
(Int -> Extractor -> ShowS)
-> (Extractor -> String)
-> ([Extractor] -> ShowS)
-> Show Extractor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Extractor] -> ShowS
$cshowList :: [Extractor] -> ShowS
show :: Extractor -> String
$cshow :: Extractor -> String
showsPrec :: Int -> Extractor -> ShowS
$cshowsPrec :: Int -> Extractor -> ShowS
Show, Extractor -> Extractor -> Bool
(Extractor -> Extractor -> Bool)
-> (Extractor -> Extractor -> Bool) -> Eq Extractor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Extractor -> Extractor -> Bool
$c/= :: Extractor -> Extractor -> Bool
== :: Extractor -> Extractor -> Bool
$c== :: Extractor -> Extractor -> Bool
Eq, (forall x. Extractor -> Rep Extractor x)
-> (forall x. Rep Extractor x -> Extractor) -> Generic Extractor
forall x. Rep Extractor x -> Extractor
forall x. Extractor -> Rep Extractor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Extractor x -> Extractor
$cfrom :: forall x. Extractor -> Rep Extractor x
Generic, )
instance NFData Extractor
instance Cacheable Extractor
instance Hashable Extractor
mkSQLOpExp ::
SQLOp ->
SQLExp ->
SQLExp ->
SQLExp
mkSQLOpExp :: SQLOp -> SQLExp -> SQLExp -> SQLExp
mkSQLOpExp SQLOp
op SQLExp
lhs SQLExp
rhs = SQLOp -> [SQLExp] -> SQLExp
SEOpApp SQLOp
op [SQLExp
lhs, SQLExp
rhs]
columnDefaultValue :: SQLExp
columnDefaultValue :: SQLExp
columnDefaultValue = Text -> SQLExp
SEUnsafe Text
"DEFAULT"
handleIfNull :: SQLExp -> SQLExp -> SQLExp
handleIfNull :: SQLExp -> SQLExp -> SQLExp
handleIfNull SQLExp
l SQLExp
e = Text -> [SQLExp] -> Maybe OrderByExp -> SQLExp
SEFnApp Text
"coalesce" [SQLExp
e, SQLExp
l] Maybe OrderByExp
forall a. Maybe a
Nothing
applyJsonBuildObj :: [SQLExp] -> SQLExp
applyJsonBuildObj :: [SQLExp] -> SQLExp
applyJsonBuildObj [SQLExp]
args =
Text -> [SQLExp] -> Maybe OrderByExp -> SQLExp
SEFnApp Text
"json_build_object" [SQLExp]
args Maybe OrderByExp
forall a. Maybe a
Nothing
applyJsonBuildArray :: [SQLExp] -> SQLExp
applyJsonBuildArray :: [SQLExp] -> SQLExp
applyJsonBuildArray [SQLExp]
args =
Text -> [SQLExp] -> Maybe OrderByExp -> SQLExp
SEFnApp Text
"json_build_array" [SQLExp]
args Maybe OrderByExp
forall a. Maybe a
Nothing
applyRowToJson :: [Extractor] -> SQLExp
applyRowToJson :: [Extractor] -> SQLExp
applyRowToJson [Extractor]
extrs =
Text -> [SQLExp] -> Maybe OrderByExp -> SQLExp
SEFnApp Text
"row_to_json" [[Extractor] -> SQLExp
mkRowExp [Extractor]
extrs] Maybe OrderByExp
forall a. Maybe a
Nothing
applyUppercase :: SQLExp -> SQLExp
applyUppercase :: SQLExp -> SQLExp
applyUppercase SQLExp
arg =
Text -> [SQLExp] -> Maybe OrderByExp -> SQLExp
SEFnApp Text
"upper" [SQLExp
arg] Maybe OrderByExp
forall a. Maybe a
Nothing
mkExtr :: (IsIdentifier a) => a -> Extractor
mkExtr :: a -> Extractor
mkExtr a
t = SQLExp -> Maybe ColumnAlias -> Extractor
Extractor (a -> SQLExp
forall a. IsIdentifier a => a -> SQLExp
mkSIdenExp a
t) Maybe ColumnAlias
forall a. Maybe a
Nothing
instance ToSQL Extractor where
toSQL :: Extractor -> Builder
toSQL (Extractor SQLExp
ce Maybe ColumnAlias
mal) =
SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
ce Builder -> Builder -> Builder
<~> Builder -> (ColumnAlias -> Builder) -> Maybe ColumnAlias -> Builder
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" ColumnAlias -> Builder
columnAliasToSqlWithAs Maybe ColumnAlias
mal
data DistinctExpr
= DistinctSimple
| DistinctOn [SQLExp]
deriving (Int -> DistinctExpr -> ShowS
[DistinctExpr] -> ShowS
DistinctExpr -> String
(Int -> DistinctExpr -> ShowS)
-> (DistinctExpr -> String)
-> ([DistinctExpr] -> ShowS)
-> Show DistinctExpr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DistinctExpr] -> ShowS
$cshowList :: [DistinctExpr] -> ShowS
show :: DistinctExpr -> String
$cshow :: DistinctExpr -> String
showsPrec :: Int -> DistinctExpr -> ShowS
$cshowsPrec :: Int -> DistinctExpr -> ShowS
Show, DistinctExpr -> DistinctExpr -> Bool
(DistinctExpr -> DistinctExpr -> Bool)
-> (DistinctExpr -> DistinctExpr -> Bool) -> Eq DistinctExpr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DistinctExpr -> DistinctExpr -> Bool
$c/= :: DistinctExpr -> DistinctExpr -> Bool
== :: DistinctExpr -> DistinctExpr -> Bool
$c== :: DistinctExpr -> DistinctExpr -> Bool
Eq, (forall x. DistinctExpr -> Rep DistinctExpr x)
-> (forall x. Rep DistinctExpr x -> DistinctExpr)
-> Generic DistinctExpr
forall x. Rep DistinctExpr x -> DistinctExpr
forall x. DistinctExpr -> Rep DistinctExpr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DistinctExpr x -> DistinctExpr
$cfrom :: forall x. DistinctExpr -> Rep DistinctExpr x
Generic, Typeable DistinctExpr
DataType
Constr
Typeable DistinctExpr
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DistinctExpr -> c DistinctExpr)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DistinctExpr)
-> (DistinctExpr -> Constr)
-> (DistinctExpr -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DistinctExpr))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DistinctExpr))
-> ((forall b. Data b => b -> b) -> DistinctExpr -> DistinctExpr)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DistinctExpr -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DistinctExpr -> r)
-> (forall u. (forall d. Data d => d -> u) -> DistinctExpr -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> DistinctExpr -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr)
-> Data DistinctExpr
DistinctExpr -> DataType
DistinctExpr -> Constr
(forall b. Data b => b -> b) -> DistinctExpr -> DistinctExpr
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DistinctExpr -> c DistinctExpr
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DistinctExpr
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> DistinctExpr -> u
forall u. (forall d. Data d => d -> u) -> DistinctExpr -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DistinctExpr -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DistinctExpr -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DistinctExpr
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DistinctExpr -> c DistinctExpr
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DistinctExpr)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DistinctExpr)
$cDistinctOn :: Constr
$cDistinctSimple :: Constr
$tDistinctExpr :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr
gmapMp :: (forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr
gmapM :: (forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> DistinctExpr -> m DistinctExpr
gmapQi :: Int -> (forall d. Data d => d -> u) -> DistinctExpr -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> DistinctExpr -> u
gmapQ :: (forall d. Data d => d -> u) -> DistinctExpr -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> DistinctExpr -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DistinctExpr -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> DistinctExpr -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DistinctExpr -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> DistinctExpr -> r
gmapT :: (forall b. Data b => b -> b) -> DistinctExpr -> DistinctExpr
$cgmapT :: (forall b. Data b => b -> b) -> DistinctExpr -> DistinctExpr
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DistinctExpr)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c DistinctExpr)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c DistinctExpr)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c DistinctExpr)
dataTypeOf :: DistinctExpr -> DataType
$cdataTypeOf :: DistinctExpr -> DataType
toConstr :: DistinctExpr -> Constr
$ctoConstr :: DistinctExpr -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DistinctExpr
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c DistinctExpr
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DistinctExpr -> c DistinctExpr
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> DistinctExpr -> c DistinctExpr
$cp1Data :: Typeable DistinctExpr
Data)
instance NFData DistinctExpr
instance Cacheable DistinctExpr
instance Hashable DistinctExpr
instance ToSQL DistinctExpr where
toSQL :: DistinctExpr -> Builder
toSQL DistinctExpr
DistinctSimple = Builder
"DISTINCT"
toSQL (DistinctOn [SQLExp]
exprs) =
Builder
"DISTINCT ON" Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (Text
"," Text -> [SQLExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [SQLExp]
exprs)
data FunctionArgs = FunctionArgs
{ FunctionArgs -> [SQLExp]
fasPostional :: [SQLExp],
FunctionArgs -> HashMap Text SQLExp
fasNamed :: (HM.HashMap Text SQLExp)
}
deriving (Int -> FunctionArgs -> ShowS
[FunctionArgs] -> ShowS
FunctionArgs -> String
(Int -> FunctionArgs -> ShowS)
-> (FunctionArgs -> String)
-> ([FunctionArgs] -> ShowS)
-> Show FunctionArgs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionArgs] -> ShowS
$cshowList :: [FunctionArgs] -> ShowS
show :: FunctionArgs -> String
$cshow :: FunctionArgs -> String
showsPrec :: Int -> FunctionArgs -> ShowS
$cshowsPrec :: Int -> FunctionArgs -> ShowS
Show, FunctionArgs -> FunctionArgs -> Bool
(FunctionArgs -> FunctionArgs -> Bool)
-> (FunctionArgs -> FunctionArgs -> Bool) -> Eq FunctionArgs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionArgs -> FunctionArgs -> Bool
$c/= :: FunctionArgs -> FunctionArgs -> Bool
== :: FunctionArgs -> FunctionArgs -> Bool
$c== :: FunctionArgs -> FunctionArgs -> Bool
Eq, (forall x. FunctionArgs -> Rep FunctionArgs x)
-> (forall x. Rep FunctionArgs x -> FunctionArgs)
-> Generic FunctionArgs
forall x. Rep FunctionArgs x -> FunctionArgs
forall x. FunctionArgs -> Rep FunctionArgs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FunctionArgs x -> FunctionArgs
$cfrom :: forall x. FunctionArgs -> Rep FunctionArgs x
Generic, Typeable FunctionArgs
DataType
Constr
Typeable FunctionArgs
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionArgs -> c FunctionArgs)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionArgs)
-> (FunctionArgs -> Constr)
-> (FunctionArgs -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionArgs))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionArgs))
-> ((forall b. Data b => b -> b) -> FunctionArgs -> FunctionArgs)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionArgs -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionArgs -> r)
-> (forall u. (forall d. Data d => d -> u) -> FunctionArgs -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> FunctionArgs -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs)
-> Data FunctionArgs
FunctionArgs -> DataType
FunctionArgs -> Constr
(forall b. Data b => b -> b) -> FunctionArgs -> FunctionArgs
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionArgs -> c FunctionArgs
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionArgs
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FunctionArgs -> u
forall u. (forall d. Data d => d -> u) -> FunctionArgs -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionArgs -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionArgs -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionArgs
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionArgs -> c FunctionArgs
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionArgs)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionArgs)
$cFunctionArgs :: Constr
$tFunctionArgs :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs
gmapMp :: (forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs
gmapM :: (forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionArgs -> m FunctionArgs
gmapQi :: Int -> (forall d. Data d => d -> u) -> FunctionArgs -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunctionArgs -> u
gmapQ :: (forall d. Data d => d -> u) -> FunctionArgs -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunctionArgs -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionArgs -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionArgs -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionArgs -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionArgs -> r
gmapT :: (forall b. Data b => b -> b) -> FunctionArgs -> FunctionArgs
$cgmapT :: (forall b. Data b => b -> b) -> FunctionArgs -> FunctionArgs
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionArgs)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionArgs)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FunctionArgs)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionArgs)
dataTypeOf :: FunctionArgs -> DataType
$cdataTypeOf :: FunctionArgs -> DataType
toConstr :: FunctionArgs -> Constr
$ctoConstr :: FunctionArgs -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionArgs
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionArgs
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionArgs -> c FunctionArgs
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionArgs -> c FunctionArgs
$cp1Data :: Typeable FunctionArgs
Data)
instance NFData FunctionArgs
instance Cacheable FunctionArgs
instance Hashable FunctionArgs
instance ToSQL FunctionArgs where
toSQL :: FunctionArgs -> Builder
toSQL (FunctionArgs [SQLExp]
positionalArgs HashMap Text SQLExp
namedArgsMap) =
let namedArgs :: [SQLExp]
namedArgs = (((Text, SQLExp) -> SQLExp) -> [(Text, SQLExp)] -> [SQLExp])
-> [(Text, SQLExp)] -> ((Text, SQLExp) -> SQLExp) -> [SQLExp]
forall a b c. (a -> b -> c) -> b -> a -> c
flip ((Text, SQLExp) -> SQLExp) -> [(Text, SQLExp)] -> [SQLExp]
forall a b. (a -> b) -> [a] -> [b]
map (HashMap Text SQLExp -> [(Text, SQLExp)]
forall k v. HashMap k v -> [(k, v)]
HM.toList HashMap Text SQLExp
namedArgsMap) (((Text, SQLExp) -> SQLExp) -> [SQLExp])
-> ((Text, SQLExp) -> SQLExp) -> [SQLExp]
forall a b. (a -> b) -> a -> b
$
\(Text
argName, SQLExp
argVal) -> Identifier -> SQLExp -> SQLExp
SENamedArg (Text -> Identifier
Identifier Text
argName) SQLExp
argVal
in Builder -> Builder
parenB (Builder -> Builder) -> Builder -> Builder
forall a b. (a -> b) -> a -> b
$ Text
", " Text -> [SQLExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> ([SQLExp]
positionalArgs [SQLExp] -> [SQLExp] -> [SQLExp]
forall a. Semigroup a => a -> a -> a
<> [SQLExp]
namedArgs)
data FunctionDefinitionListItem = FunctionDefinitionListItem
{ FunctionDefinitionListItem -> ColumnAlias
_dliColumn :: ColumnAlias,
FunctionDefinitionListItem -> PGScalarType
_dliType :: PGScalarType
}
deriving (Int -> FunctionDefinitionListItem -> ShowS
[FunctionDefinitionListItem] -> ShowS
FunctionDefinitionListItem -> String
(Int -> FunctionDefinitionListItem -> ShowS)
-> (FunctionDefinitionListItem -> String)
-> ([FunctionDefinitionListItem] -> ShowS)
-> Show FunctionDefinitionListItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionDefinitionListItem] -> ShowS
$cshowList :: [FunctionDefinitionListItem] -> ShowS
show :: FunctionDefinitionListItem -> String
$cshow :: FunctionDefinitionListItem -> String
showsPrec :: Int -> FunctionDefinitionListItem -> ShowS
$cshowsPrec :: Int -> FunctionDefinitionListItem -> ShowS
Show, FunctionDefinitionListItem -> FunctionDefinitionListItem -> Bool
(FunctionDefinitionListItem -> FunctionDefinitionListItem -> Bool)
-> (FunctionDefinitionListItem
-> FunctionDefinitionListItem -> Bool)
-> Eq FunctionDefinitionListItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionDefinitionListItem -> FunctionDefinitionListItem -> Bool
$c/= :: FunctionDefinitionListItem -> FunctionDefinitionListItem -> Bool
== :: FunctionDefinitionListItem -> FunctionDefinitionListItem -> Bool
$c== :: FunctionDefinitionListItem -> FunctionDefinitionListItem -> Bool
Eq, Typeable FunctionDefinitionListItem
DataType
Constr
Typeable FunctionDefinitionListItem
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> FunctionDefinitionListItem
-> c FunctionDefinitionListItem)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionDefinitionListItem)
-> (FunctionDefinitionListItem -> Constr)
-> (FunctionDefinitionListItem -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c FunctionDefinitionListItem))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionDefinitionListItem))
-> ((forall b. Data b => b -> b)
-> FunctionDefinitionListItem -> FunctionDefinitionListItem)
-> (forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> FunctionDefinitionListItem
-> r)
-> (forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> FunctionDefinitionListItem
-> r)
-> (forall u.
(forall d. Data d => d -> u) -> FunctionDefinitionListItem -> [u])
-> (forall u.
Int
-> (forall d. Data d => d -> u) -> FunctionDefinitionListItem -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem)
-> Data FunctionDefinitionListItem
FunctionDefinitionListItem -> DataType
FunctionDefinitionListItem -> Constr
(forall b. Data b => b -> b)
-> FunctionDefinitionListItem -> FunctionDefinitionListItem
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> FunctionDefinitionListItem
-> c FunctionDefinitionListItem
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionDefinitionListItem
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int
-> (forall d. Data d => d -> u) -> FunctionDefinitionListItem -> u
forall u.
(forall d. Data d => d -> u) -> FunctionDefinitionListItem -> [u]
forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> FunctionDefinitionListItem
-> r
forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> FunctionDefinitionListItem
-> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionDefinitionListItem
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> FunctionDefinitionListItem
-> c FunctionDefinitionListItem
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c FunctionDefinitionListItem)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionDefinitionListItem)
$cFunctionDefinitionListItem :: Constr
$tFunctionDefinitionListItem :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem
gmapMp :: (forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem
gmapM :: (forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> FunctionDefinitionListItem -> m FunctionDefinitionListItem
gmapQi :: Int
-> (forall d. Data d => d -> u) -> FunctionDefinitionListItem -> u
$cgmapQi :: forall u.
Int
-> (forall d. Data d => d -> u) -> FunctionDefinitionListItem -> u
gmapQ :: (forall d. Data d => d -> u) -> FunctionDefinitionListItem -> [u]
$cgmapQ :: forall u.
(forall d. Data d => d -> u) -> FunctionDefinitionListItem -> [u]
gmapQr :: (r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> FunctionDefinitionListItem
-> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> FunctionDefinitionListItem
-> r
gmapQl :: (r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> FunctionDefinitionListItem
-> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> FunctionDefinitionListItem
-> r
gmapT :: (forall b. Data b => b -> b)
-> FunctionDefinitionListItem -> FunctionDefinitionListItem
$cgmapT :: (forall b. Data b => b -> b)
-> FunctionDefinitionListItem -> FunctionDefinitionListItem
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionDefinitionListItem)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionDefinitionListItem)
dataCast1 :: (forall d. Data d => c (t d))
-> Maybe (c FunctionDefinitionListItem)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d))
-> Maybe (c FunctionDefinitionListItem)
dataTypeOf :: FunctionDefinitionListItem -> DataType
$cdataTypeOf :: FunctionDefinitionListItem -> DataType
toConstr :: FunctionDefinitionListItem -> Constr
$ctoConstr :: FunctionDefinitionListItem -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionDefinitionListItem
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionDefinitionListItem
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> FunctionDefinitionListItem
-> c FunctionDefinitionListItem
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> FunctionDefinitionListItem
-> c FunctionDefinitionListItem
$cp1Data :: Typeable FunctionDefinitionListItem
Data, (forall x.
FunctionDefinitionListItem -> Rep FunctionDefinitionListItem x)
-> (forall x.
Rep FunctionDefinitionListItem x -> FunctionDefinitionListItem)
-> Generic FunctionDefinitionListItem
forall x.
Rep FunctionDefinitionListItem x -> FunctionDefinitionListItem
forall x.
FunctionDefinitionListItem -> Rep FunctionDefinitionListItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FunctionDefinitionListItem x -> FunctionDefinitionListItem
$cfrom :: forall x.
FunctionDefinitionListItem -> Rep FunctionDefinitionListItem x
Generic)
instance NFData FunctionDefinitionListItem
instance Cacheable FunctionDefinitionListItem
instance Hashable FunctionDefinitionListItem
instance ToSQL FunctionDefinitionListItem where
toSQL :: FunctionDefinitionListItem -> Builder
toSQL (FunctionDefinitionListItem ColumnAlias
column PGScalarType
columnType) =
ColumnAlias -> Builder
columnAliasToSqlWithoutAs ColumnAlias
column Builder -> Builder -> Builder
<~> PGScalarType -> Builder
forall a. ToSQL a => a -> Builder
toSQL PGScalarType
columnType
data FunctionAlias = FunctionAlias
{ FunctionAlias -> TableAlias
_faIdentifier :: TableAlias,
FunctionAlias -> Maybe [FunctionDefinitionListItem]
_faDefinitionList :: Maybe [FunctionDefinitionListItem]
}
deriving (Int -> FunctionAlias -> ShowS
[FunctionAlias] -> ShowS
FunctionAlias -> String
(Int -> FunctionAlias -> ShowS)
-> (FunctionAlias -> String)
-> ([FunctionAlias] -> ShowS)
-> Show FunctionAlias
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionAlias] -> ShowS
$cshowList :: [FunctionAlias] -> ShowS
show :: FunctionAlias -> String
$cshow :: FunctionAlias -> String
showsPrec :: Int -> FunctionAlias -> ShowS
$cshowsPrec :: Int -> FunctionAlias -> ShowS
Show, FunctionAlias -> FunctionAlias -> Bool
(FunctionAlias -> FunctionAlias -> Bool)
-> (FunctionAlias -> FunctionAlias -> Bool) -> Eq FunctionAlias
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionAlias -> FunctionAlias -> Bool
$c/= :: FunctionAlias -> FunctionAlias -> Bool
== :: FunctionAlias -> FunctionAlias -> Bool
$c== :: FunctionAlias -> FunctionAlias -> Bool
Eq, Typeable FunctionAlias
DataType
Constr
Typeable FunctionAlias
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAlias -> c FunctionAlias)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAlias)
-> (FunctionAlias -> Constr)
-> (FunctionAlias -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionAlias))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAlias))
-> ((forall b. Data b => b -> b) -> FunctionAlias -> FunctionAlias)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAlias -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAlias -> r)
-> (forall u. (forall d. Data d => d -> u) -> FunctionAlias -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> FunctionAlias -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias)
-> Data FunctionAlias
FunctionAlias -> DataType
FunctionAlias -> Constr
(forall b. Data b => b -> b) -> FunctionAlias -> FunctionAlias
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAlias -> c FunctionAlias
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAlias
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FunctionAlias -> u
forall u. (forall d. Data d => d -> u) -> FunctionAlias -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAlias -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAlias -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAlias
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAlias -> c FunctionAlias
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionAlias)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAlias)
$cFunctionAlias :: Constr
$tFunctionAlias :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias
gmapMp :: (forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias
gmapM :: (forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionAlias -> m FunctionAlias
gmapQi :: Int -> (forall d. Data d => d -> u) -> FunctionAlias -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunctionAlias -> u
gmapQ :: (forall d. Data d => d -> u) -> FunctionAlias -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunctionAlias -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAlias -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAlias -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAlias -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionAlias -> r
gmapT :: (forall b. Data b => b -> b) -> FunctionAlias -> FunctionAlias
$cgmapT :: (forall b. Data b => b -> b) -> FunctionAlias -> FunctionAlias
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAlias)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionAlias)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FunctionAlias)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionAlias)
dataTypeOf :: FunctionAlias -> DataType
$cdataTypeOf :: FunctionAlias -> DataType
toConstr :: FunctionAlias -> Constr
$ctoConstr :: FunctionAlias -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAlias
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionAlias
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAlias -> c FunctionAlias
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionAlias -> c FunctionAlias
$cp1Data :: Typeable FunctionAlias
Data, (forall x. FunctionAlias -> Rep FunctionAlias x)
-> (forall x. Rep FunctionAlias x -> FunctionAlias)
-> Generic FunctionAlias
forall x. Rep FunctionAlias x -> FunctionAlias
forall x. FunctionAlias -> Rep FunctionAlias x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FunctionAlias x -> FunctionAlias
$cfrom :: forall x. FunctionAlias -> Rep FunctionAlias x
Generic)
instance NFData FunctionAlias
instance Cacheable FunctionAlias
instance Hashable FunctionAlias
mkFunctionAlias :: TableAlias -> Maybe [(ColumnAlias, PGScalarType)] -> FunctionAlias
mkFunctionAlias :: TableAlias -> Maybe [(ColumnAlias, PGScalarType)] -> FunctionAlias
mkFunctionAlias TableAlias
alias Maybe [(ColumnAlias, PGScalarType)]
listM =
TableAlias -> Maybe [FunctionDefinitionListItem] -> FunctionAlias
FunctionAlias TableAlias
alias (Maybe [FunctionDefinitionListItem] -> FunctionAlias)
-> Maybe [FunctionDefinitionListItem] -> FunctionAlias
forall a b. (a -> b) -> a -> b
$
([(ColumnAlias, PGScalarType)] -> [FunctionDefinitionListItem])
-> Maybe [(ColumnAlias, PGScalarType)]
-> Maybe [FunctionDefinitionListItem]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (((ColumnAlias, PGScalarType) -> FunctionDefinitionListItem)
-> [(ColumnAlias, PGScalarType)] -> [FunctionDefinitionListItem]
forall a b. (a -> b) -> [a] -> [b]
map ((ColumnAlias -> PGScalarType -> FunctionDefinitionListItem)
-> (ColumnAlias, PGScalarType) -> FunctionDefinitionListItem
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry ColumnAlias -> PGScalarType -> FunctionDefinitionListItem
FunctionDefinitionListItem)) Maybe [(ColumnAlias, PGScalarType)]
listM
instance ToSQL FunctionAlias where
toSQL :: FunctionAlias -> Builder
toSQL (FunctionAlias TableAlias
tableAlias (Just [FunctionDefinitionListItem]
definitionList)) =
TableAlias -> Builder
tableAliasToSqlWithAs TableAlias
tableAlias Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> Builder
parenB (Text
", " Text -> [FunctionDefinitionListItem] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [FunctionDefinitionListItem]
definitionList)
toSQL (FunctionAlias TableAlias
tableAlias Maybe [FunctionDefinitionListItem]
Nothing) =
TableAlias -> Builder
tableAliasToSqlWithAs TableAlias
tableAlias
data FunctionExp = FunctionExp
{ FunctionExp -> QualifiedFunction
feName :: QualifiedFunction,
FunctionExp -> FunctionArgs
feArgs :: FunctionArgs,
FunctionExp -> Maybe FunctionAlias
feAlias :: Maybe FunctionAlias
}
deriving (Int -> FunctionExp -> ShowS
[FunctionExp] -> ShowS
FunctionExp -> String
(Int -> FunctionExp -> ShowS)
-> (FunctionExp -> String)
-> ([FunctionExp] -> ShowS)
-> Show FunctionExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FunctionExp] -> ShowS
$cshowList :: [FunctionExp] -> ShowS
show :: FunctionExp -> String
$cshow :: FunctionExp -> String
showsPrec :: Int -> FunctionExp -> ShowS
$cshowsPrec :: Int -> FunctionExp -> ShowS
Show, FunctionExp -> FunctionExp -> Bool
(FunctionExp -> FunctionExp -> Bool)
-> (FunctionExp -> FunctionExp -> Bool) -> Eq FunctionExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FunctionExp -> FunctionExp -> Bool
$c/= :: FunctionExp -> FunctionExp -> Bool
== :: FunctionExp -> FunctionExp -> Bool
$c== :: FunctionExp -> FunctionExp -> Bool
Eq, (forall x. FunctionExp -> Rep FunctionExp x)
-> (forall x. Rep FunctionExp x -> FunctionExp)
-> Generic FunctionExp
forall x. Rep FunctionExp x -> FunctionExp
forall x. FunctionExp -> Rep FunctionExp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FunctionExp x -> FunctionExp
$cfrom :: forall x. FunctionExp -> Rep FunctionExp x
Generic, Typeable FunctionExp
DataType
Constr
Typeable FunctionExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionExp -> c FunctionExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionExp)
-> (FunctionExp -> Constr)
-> (FunctionExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionExp))
-> ((forall b. Data b => b -> b) -> FunctionExp -> FunctionExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> FunctionExp -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> FunctionExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp)
-> Data FunctionExp
FunctionExp -> DataType
FunctionExp -> Constr
(forall b. Data b => b -> b) -> FunctionExp -> FunctionExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionExp -> c FunctionExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FunctionExp -> u
forall u. (forall d. Data d => d -> u) -> FunctionExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionExp -> c FunctionExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionExp)
$cFunctionExp :: Constr
$tFunctionExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp
gmapMp :: (forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp
gmapM :: (forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FunctionExp -> m FunctionExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> FunctionExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FunctionExp -> u
gmapQ :: (forall d. Data d => d -> u) -> FunctionExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FunctionExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FunctionExp -> r
gmapT :: (forall b. Data b => b -> b) -> FunctionExp -> FunctionExp
$cgmapT :: (forall b. Data b => b -> b) -> FunctionExp -> FunctionExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c FunctionExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FunctionExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FunctionExp)
dataTypeOf :: FunctionExp -> DataType
$cdataTypeOf :: FunctionExp -> DataType
toConstr :: FunctionExp -> Constr
$ctoConstr :: FunctionExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FunctionExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionExp -> c FunctionExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FunctionExp -> c FunctionExp
$cp1Data :: Typeable FunctionExp
Data)
instance NFData FunctionExp
instance Cacheable FunctionExp
instance Hashable FunctionExp
instance ToSQL FunctionExp where
toSQL :: FunctionExp -> Builder
toSQL (FunctionExp QualifiedFunction
qf FunctionArgs
args Maybe FunctionAlias
alsM) =
QualifiedFunction -> Builder
forall a. ToSQL a => a -> Builder
toSQL QualifiedFunction
qf Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> FunctionArgs -> Builder
forall a. ToSQL a => a -> Builder
toSQL FunctionArgs
args Builder -> Builder -> Builder
<~> Maybe FunctionAlias -> Builder
forall a. ToSQL a => a -> Builder
toSQL Maybe FunctionAlias
alsM
data FromItem
=
FISimple QualifiedTable (Maybe TableAlias)
|
FIIdentifier Identifier
|
FIFunc FunctionExp
|
FIUnnest [SQLExp] TableAlias [ColumnAlias]
| FISelect Lateral Select TableAlias
| FISelectWith Lateral (SelectWithG Select) TableAlias
| FIValues ValuesExp TableAlias (Maybe [ColumnAlias])
| FIJoin JoinExpr
deriving (Int -> FromItem -> ShowS
[FromItem] -> ShowS
FromItem -> String
(Int -> FromItem -> ShowS)
-> (FromItem -> String) -> ([FromItem] -> ShowS) -> Show FromItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FromItem] -> ShowS
$cshowList :: [FromItem] -> ShowS
show :: FromItem -> String
$cshow :: FromItem -> String
showsPrec :: Int -> FromItem -> ShowS
$cshowsPrec :: Int -> FromItem -> ShowS
Show, FromItem -> FromItem -> Bool
(FromItem -> FromItem -> Bool)
-> (FromItem -> FromItem -> Bool) -> Eq FromItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FromItem -> FromItem -> Bool
$c/= :: FromItem -> FromItem -> Bool
== :: FromItem -> FromItem -> Bool
$c== :: FromItem -> FromItem -> Bool
Eq, (forall x. FromItem -> Rep FromItem x)
-> (forall x. Rep FromItem x -> FromItem) -> Generic FromItem
forall x. Rep FromItem x -> FromItem
forall x. FromItem -> Rep FromItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FromItem x -> FromItem
$cfrom :: forall x. FromItem -> Rep FromItem x
Generic, Typeable FromItem
DataType
Constr
Typeable FromItem
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromItem -> c FromItem)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromItem)
-> (FromItem -> Constr)
-> (FromItem -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FromItem))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FromItem))
-> ((forall b. Data b => b -> b) -> FromItem -> FromItem)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FromItem -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FromItem -> r)
-> (forall u. (forall d. Data d => d -> u) -> FromItem -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> FromItem -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FromItem -> m FromItem)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromItem -> m FromItem)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromItem -> m FromItem)
-> Data FromItem
FromItem -> DataType
FromItem -> Constr
(forall b. Data b => b -> b) -> FromItem -> FromItem
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromItem -> c FromItem
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromItem
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> FromItem -> u
forall u. (forall d. Data d => d -> u) -> FromItem -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FromItem -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FromItem -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FromItem -> m FromItem
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromItem -> m FromItem
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromItem
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromItem -> c FromItem
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FromItem)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FromItem)
$cFIJoin :: Constr
$cFIValues :: Constr
$cFISelectWith :: Constr
$cFISelect :: Constr
$cFIUnnest :: Constr
$cFIFunc :: Constr
$cFIIdentifier :: Constr
$cFISimple :: Constr
$tFromItem :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> FromItem -> m FromItem
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromItem -> m FromItem
gmapMp :: (forall d. Data d => d -> m d) -> FromItem -> m FromItem
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> FromItem -> m FromItem
gmapM :: (forall d. Data d => d -> m d) -> FromItem -> m FromItem
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> FromItem -> m FromItem
gmapQi :: Int -> (forall d. Data d => d -> u) -> FromItem -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> FromItem -> u
gmapQ :: (forall d. Data d => d -> u) -> FromItem -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> FromItem -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FromItem -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> FromItem -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FromItem -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> FromItem -> r
gmapT :: (forall b. Data b => b -> b) -> FromItem -> FromItem
$cgmapT :: (forall b. Data b => b -> b) -> FromItem -> FromItem
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FromItem)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FromItem)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c FromItem)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c FromItem)
dataTypeOf :: FromItem -> DataType
$cdataTypeOf :: FromItem -> DataType
toConstr :: FromItem -> Constr
$ctoConstr :: FromItem -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromItem
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c FromItem
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromItem -> c FromItem
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> FromItem -> c FromItem
$cp1Data :: Typeable FromItem
Data)
instance NFData FromItem
instance Cacheable FromItem
instance Hashable FromItem
mkSelFromItem :: Select -> TableAlias -> FromItem
mkSelFromItem :: Select -> TableAlias -> FromItem
mkSelFromItem = Lateral -> Select -> TableAlias -> FromItem
FISelect (Bool -> Lateral
Lateral Bool
False)
mkSelectWithFromItem :: SelectWithG Select -> TableAlias -> FromItem
mkSelectWithFromItem :: SelectWithG Select -> TableAlias -> FromItem
mkSelectWithFromItem = Lateral -> SelectWithG Select -> TableAlias -> FromItem
FISelectWith (Bool -> Lateral
Lateral Bool
False)
mkLateralFromItem :: Select -> TableAlias -> FromItem
mkLateralFromItem :: Select -> TableAlias -> FromItem
mkLateralFromItem = Lateral -> Select -> TableAlias -> FromItem
FISelect (Bool -> Lateral
Lateral Bool
True)
instance ToSQL FromItem where
toSQL :: FromItem -> Builder
toSQL (FISimple QualifiedTable
qualifiedTable Maybe TableAlias
tableAlias) =
QualifiedTable -> Builder
forall a. ToSQL a => a -> Builder
toSQL QualifiedTable
qualifiedTable Builder -> Builder -> Builder
<~> Builder -> (TableAlias -> Builder) -> Maybe TableAlias -> Builder
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" TableAlias -> Builder
tableAliasToSqlWithAs Maybe TableAlias
tableAlias
toSQL (FIIdentifier Identifier
iden) =
Identifier -> Builder
forall a. ToSQL a => a -> Builder
toSQL Identifier
iden
toSQL (FIFunc FunctionExp
funcExp) = FunctionExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL FunctionExp
funcExp
toSQL (FIUnnest [SQLExp]
args TableAlias
tableAlias [ColumnAlias]
cols) =
Builder
"UNNEST"
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> Builder
parenB (Text
", " Text -> [SQLExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [SQLExp]
args)
Builder -> Builder -> Builder
<~> TableAlias -> Builder
tableAliasToSqlWithAs TableAlias
tableAlias
Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> Builder
parenB (Text
", " Text -> [Builder] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> (ColumnAlias -> Builder) -> [ColumnAlias] -> [Builder]
forall a b. (a -> b) -> [a] -> [b]
map ColumnAlias -> Builder
columnAliasToSqlWithoutAs [ColumnAlias]
cols)
toSQL (FISelect Lateral
isLateral Select
select TableAlias
alias) =
Lateral -> Builder
forall a. ToSQL a => a -> Builder
toSQL Lateral
isLateral Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (Select -> Builder
forall a. ToSQL a => a -> Builder
toSQL Select
select) Builder -> Builder -> Builder
<~> TableAlias -> Builder
tableAliasToSqlWithAs TableAlias
alias
toSQL (FISelectWith Lateral
isLateral SelectWithG Select
selectWith TableAlias
alias) =
Lateral -> Builder
forall a. ToSQL a => a -> Builder
toSQL Lateral
isLateral Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (SelectWithG Select -> Builder
forall a. ToSQL a => a -> Builder
toSQL SelectWithG Select
selectWith) Builder -> Builder -> Builder
<~> TableAlias -> Builder
tableAliasToSqlWithAs TableAlias
alias
toSQL (FIValues ValuesExp
valsExp TableAlias
alias Maybe [ColumnAlias]
columnAliases) =
Builder -> Builder
parenB (ValuesExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL ValuesExp
valsExp) Builder -> Builder -> Builder
<~> TableAlias -> Builder
tableAliasToSqlWithAs TableAlias
alias
Builder -> Builder -> Builder
<~> case Maybe [ColumnAlias]
columnAliases of
Maybe [ColumnAlias]
Nothing -> Builder
""
Just [ColumnAlias]
cols -> Builder -> Builder
parenB (Text
", " Text -> [Builder] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> (ColumnAlias -> Builder) -> [ColumnAlias] -> [Builder]
forall a b. (a -> b) -> [a] -> [b]
map ColumnAlias -> Builder
columnAliasToSqlWithoutAs [ColumnAlias]
cols)
toSQL (FIJoin JoinExpr
je) =
JoinExpr -> Builder
forall a. ToSQL a => a -> Builder
toSQL JoinExpr
je
newtype Lateral = Lateral Bool
deriving (Int -> Lateral -> ShowS
[Lateral] -> ShowS
Lateral -> String
(Int -> Lateral -> ShowS)
-> (Lateral -> String) -> ([Lateral] -> ShowS) -> Show Lateral
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Lateral] -> ShowS
$cshowList :: [Lateral] -> ShowS
show :: Lateral -> String
$cshow :: Lateral -> String
showsPrec :: Int -> Lateral -> ShowS
$cshowsPrec :: Int -> Lateral -> ShowS
Show, Lateral -> Lateral -> Bool
(Lateral -> Lateral -> Bool)
-> (Lateral -> Lateral -> Bool) -> Eq Lateral
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Lateral -> Lateral -> Bool
$c/= :: Lateral -> Lateral -> Bool
== :: Lateral -> Lateral -> Bool
$c== :: Lateral -> Lateral -> Bool
Eq, Typeable Lateral
DataType
Constr
Typeable Lateral
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Lateral -> c Lateral)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Lateral)
-> (Lateral -> Constr)
-> (Lateral -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Lateral))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Lateral))
-> ((forall b. Data b => b -> b) -> Lateral -> Lateral)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Lateral -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Lateral -> r)
-> (forall u. (forall d. Data d => d -> u) -> Lateral -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> Lateral -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Lateral -> m Lateral)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Lateral -> m Lateral)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Lateral -> m Lateral)
-> Data Lateral
Lateral -> DataType
Lateral -> Constr
(forall b. Data b => b -> b) -> Lateral -> Lateral
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Lateral -> c Lateral
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Lateral
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Lateral -> u
forall u. (forall d. Data d => d -> u) -> Lateral -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Lateral -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Lateral -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Lateral -> m Lateral
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Lateral -> m Lateral
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Lateral
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Lateral -> c Lateral
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Lateral)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Lateral)
$cLateral :: Constr
$tLateral :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Lateral -> m Lateral
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Lateral -> m Lateral
gmapMp :: (forall d. Data d => d -> m d) -> Lateral -> m Lateral
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Lateral -> m Lateral
gmapM :: (forall d. Data d => d -> m d) -> Lateral -> m Lateral
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Lateral -> m Lateral
gmapQi :: Int -> (forall d. Data d => d -> u) -> Lateral -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Lateral -> u
gmapQ :: (forall d. Data d => d -> u) -> Lateral -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> Lateral -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Lateral -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Lateral -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Lateral -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Lateral -> r
gmapT :: (forall b. Data b => b -> b) -> Lateral -> Lateral
$cgmapT :: (forall b. Data b => b -> b) -> Lateral -> Lateral
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Lateral)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Lateral)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c Lateral)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c Lateral)
dataTypeOf :: Lateral -> DataType
$cdataTypeOf :: Lateral -> DataType
toConstr :: Lateral -> Constr
$ctoConstr :: Lateral -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Lateral
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c Lateral
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Lateral -> c Lateral
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Lateral -> c Lateral
$cp1Data :: Typeable Lateral
Data, Lateral -> ()
(Lateral -> ()) -> NFData Lateral
forall a. (a -> ()) -> NFData a
rnf :: Lateral -> ()
$crnf :: Lateral -> ()
NFData, Eq Lateral
Eq Lateral
-> (Accesses -> Lateral -> Lateral -> Bool) -> Cacheable Lateral
Accesses -> Lateral -> Lateral -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> Lateral -> Lateral -> Bool
$cunchanged :: Accesses -> Lateral -> Lateral -> Bool
$cp1Cacheable :: Eq Lateral
Cacheable, Int -> Lateral -> Int
Lateral -> Int
(Int -> Lateral -> Int) -> (Lateral -> Int) -> Hashable Lateral
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: Lateral -> Int
$chash :: Lateral -> Int
hashWithSalt :: Int -> Lateral -> Int
$chashWithSalt :: Int -> Lateral -> Int
Hashable)
instance ToSQL Lateral where
toSQL :: Lateral -> Builder
toSQL (Lateral Bool
True) = Builder
"LATERAL"
toSQL (Lateral Bool
False) = Builder
forall a. Monoid a => a
mempty
data JoinExpr = JoinExpr
{ JoinExpr -> FromItem
tjeLeft :: FromItem,
JoinExpr -> JoinType
tjeType :: JoinType,
JoinExpr -> FromItem
tjeRight :: FromItem,
JoinExpr -> JoinCond
tjeJC :: JoinCond
}
deriving (Int -> JoinExpr -> ShowS
[JoinExpr] -> ShowS
JoinExpr -> String
(Int -> JoinExpr -> ShowS)
-> (JoinExpr -> String) -> ([JoinExpr] -> ShowS) -> Show JoinExpr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JoinExpr] -> ShowS
$cshowList :: [JoinExpr] -> ShowS
show :: JoinExpr -> String
$cshow :: JoinExpr -> String
showsPrec :: Int -> JoinExpr -> ShowS
$cshowsPrec :: Int -> JoinExpr -> ShowS
Show, JoinExpr -> JoinExpr -> Bool
(JoinExpr -> JoinExpr -> Bool)
-> (JoinExpr -> JoinExpr -> Bool) -> Eq JoinExpr
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JoinExpr -> JoinExpr -> Bool
$c/= :: JoinExpr -> JoinExpr -> Bool
== :: JoinExpr -> JoinExpr -> Bool
$c== :: JoinExpr -> JoinExpr -> Bool
Eq, (forall x. JoinExpr -> Rep JoinExpr x)
-> (forall x. Rep JoinExpr x -> JoinExpr) -> Generic JoinExpr
forall x. Rep JoinExpr x -> JoinExpr
forall x. JoinExpr -> Rep JoinExpr x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JoinExpr x -> JoinExpr
$cfrom :: forall x. JoinExpr -> Rep JoinExpr x
Generic, Typeable JoinExpr
DataType
Constr
Typeable JoinExpr
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinExpr -> c JoinExpr)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinExpr)
-> (JoinExpr -> Constr)
-> (JoinExpr -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JoinExpr))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinExpr))
-> ((forall b. Data b => b -> b) -> JoinExpr -> JoinExpr)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinExpr -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinExpr -> r)
-> (forall u. (forall d. Data d => d -> u) -> JoinExpr -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> JoinExpr -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr)
-> Data JoinExpr
JoinExpr -> DataType
JoinExpr -> Constr
(forall b. Data b => b -> b) -> JoinExpr -> JoinExpr
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinExpr -> c JoinExpr
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinExpr
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> JoinExpr -> u
forall u. (forall d. Data d => d -> u) -> JoinExpr -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinExpr -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinExpr -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinExpr
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinExpr -> c JoinExpr
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JoinExpr)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinExpr)
$cJoinExpr :: Constr
$tJoinExpr :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr
gmapMp :: (forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr
gmapM :: (forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JoinExpr -> m JoinExpr
gmapQi :: Int -> (forall d. Data d => d -> u) -> JoinExpr -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> JoinExpr -> u
gmapQ :: (forall d. Data d => d -> u) -> JoinExpr -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> JoinExpr -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinExpr -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinExpr -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinExpr -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinExpr -> r
gmapT :: (forall b. Data b => b -> b) -> JoinExpr -> JoinExpr
$cgmapT :: (forall b. Data b => b -> b) -> JoinExpr -> JoinExpr
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinExpr)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinExpr)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c JoinExpr)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JoinExpr)
dataTypeOf :: JoinExpr -> DataType
$cdataTypeOf :: JoinExpr -> DataType
toConstr :: JoinExpr -> Constr
$ctoConstr :: JoinExpr -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinExpr
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinExpr
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinExpr -> c JoinExpr
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinExpr -> c JoinExpr
$cp1Data :: Typeable JoinExpr
Data)
instance NFData JoinExpr
instance Cacheable JoinExpr
instance Hashable JoinExpr
instance ToSQL JoinExpr where
toSQL :: JoinExpr -> Builder
toSQL JoinExpr
je =
FromItem -> Builder
forall a. ToSQL a => a -> Builder
toSQL (JoinExpr -> FromItem
tjeLeft JoinExpr
je)
Builder -> Builder -> Builder
<~> JoinType -> Builder
forall a. ToSQL a => a -> Builder
toSQL (JoinExpr -> JoinType
tjeType JoinExpr
je)
Builder -> Builder -> Builder
<~> FromItem -> Builder
forall a. ToSQL a => a -> Builder
toSQL (JoinExpr -> FromItem
tjeRight JoinExpr
je)
Builder -> Builder -> Builder
<~> JoinCond -> Builder
forall a. ToSQL a => a -> Builder
toSQL (JoinExpr -> JoinCond
tjeJC JoinExpr
je)
data JoinType
= Inner
| LeftOuter
| RightOuter
| FullOuter
deriving (JoinType -> JoinType -> Bool
(JoinType -> JoinType -> Bool)
-> (JoinType -> JoinType -> Bool) -> Eq JoinType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JoinType -> JoinType -> Bool
$c/= :: JoinType -> JoinType -> Bool
== :: JoinType -> JoinType -> Bool
$c== :: JoinType -> JoinType -> Bool
Eq, Int -> JoinType -> ShowS
[JoinType] -> ShowS
JoinType -> String
(Int -> JoinType -> ShowS)
-> (JoinType -> String) -> ([JoinType] -> ShowS) -> Show JoinType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JoinType] -> ShowS
$cshowList :: [JoinType] -> ShowS
show :: JoinType -> String
$cshow :: JoinType -> String
showsPrec :: Int -> JoinType -> ShowS
$cshowsPrec :: Int -> JoinType -> ShowS
Show, (forall x. JoinType -> Rep JoinType x)
-> (forall x. Rep JoinType x -> JoinType) -> Generic JoinType
forall x. Rep JoinType x -> JoinType
forall x. JoinType -> Rep JoinType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JoinType x -> JoinType
$cfrom :: forall x. JoinType -> Rep JoinType x
Generic, Typeable JoinType
DataType
Constr
Typeable JoinType
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinType -> c JoinType)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinType)
-> (JoinType -> Constr)
-> (JoinType -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JoinType))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinType))
-> ((forall b. Data b => b -> b) -> JoinType -> JoinType)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinType -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinType -> r)
-> (forall u. (forall d. Data d => d -> u) -> JoinType -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> JoinType -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JoinType -> m JoinType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinType -> m JoinType)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinType -> m JoinType)
-> Data JoinType
JoinType -> DataType
JoinType -> Constr
(forall b. Data b => b -> b) -> JoinType -> JoinType
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinType -> c JoinType
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinType
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> JoinType -> u
forall u. (forall d. Data d => d -> u) -> JoinType -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinType -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinType -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JoinType -> m JoinType
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinType -> m JoinType
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinType
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinType -> c JoinType
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JoinType)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinType)
$cFullOuter :: Constr
$cRightOuter :: Constr
$cLeftOuter :: Constr
$cInner :: Constr
$tJoinType :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> JoinType -> m JoinType
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinType -> m JoinType
gmapMp :: (forall d. Data d => d -> m d) -> JoinType -> m JoinType
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinType -> m JoinType
gmapM :: (forall d. Data d => d -> m d) -> JoinType -> m JoinType
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JoinType -> m JoinType
gmapQi :: Int -> (forall d. Data d => d -> u) -> JoinType -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> JoinType -> u
gmapQ :: (forall d. Data d => d -> u) -> JoinType -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> JoinType -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinType -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinType -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinType -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinType -> r
gmapT :: (forall b. Data b => b -> b) -> JoinType -> JoinType
$cgmapT :: (forall b. Data b => b -> b) -> JoinType -> JoinType
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinType)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinType)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c JoinType)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JoinType)
dataTypeOf :: JoinType -> DataType
$cdataTypeOf :: JoinType -> DataType
toConstr :: JoinType -> Constr
$ctoConstr :: JoinType -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinType
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinType
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinType -> c JoinType
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinType -> c JoinType
$cp1Data :: Typeable JoinType
Data)
instance NFData JoinType
instance Cacheable JoinType
instance Hashable JoinType
instance ToSQL JoinType where
toSQL :: JoinType -> Builder
toSQL JoinType
Inner = Builder
"INNER JOIN"
toSQL JoinType
LeftOuter = Builder
"LEFT OUTER JOIN"
toSQL JoinType
RightOuter = Builder
"RIGHT OUTER JOIN"
toSQL JoinType
FullOuter = Builder
"FULL OUTER JOIN"
data JoinCond
= JoinOn BoolExp
| JoinUsing [Identifier]
deriving (Int -> JoinCond -> ShowS
[JoinCond] -> ShowS
JoinCond -> String
(Int -> JoinCond -> ShowS)
-> (JoinCond -> String) -> ([JoinCond] -> ShowS) -> Show JoinCond
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JoinCond] -> ShowS
$cshowList :: [JoinCond] -> ShowS
show :: JoinCond -> String
$cshow :: JoinCond -> String
showsPrec :: Int -> JoinCond -> ShowS
$cshowsPrec :: Int -> JoinCond -> ShowS
Show, JoinCond -> JoinCond -> Bool
(JoinCond -> JoinCond -> Bool)
-> (JoinCond -> JoinCond -> Bool) -> Eq JoinCond
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JoinCond -> JoinCond -> Bool
$c/= :: JoinCond -> JoinCond -> Bool
== :: JoinCond -> JoinCond -> Bool
$c== :: JoinCond -> JoinCond -> Bool
Eq, (forall x. JoinCond -> Rep JoinCond x)
-> (forall x. Rep JoinCond x -> JoinCond) -> Generic JoinCond
forall x. Rep JoinCond x -> JoinCond
forall x. JoinCond -> Rep JoinCond x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JoinCond x -> JoinCond
$cfrom :: forall x. JoinCond -> Rep JoinCond x
Generic, Typeable JoinCond
DataType
Constr
Typeable JoinCond
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinCond -> c JoinCond)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinCond)
-> (JoinCond -> Constr)
-> (JoinCond -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JoinCond))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinCond))
-> ((forall b. Data b => b -> b) -> JoinCond -> JoinCond)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinCond -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinCond -> r)
-> (forall u. (forall d. Data d => d -> u) -> JoinCond -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> JoinCond -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JoinCond -> m JoinCond)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinCond -> m JoinCond)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinCond -> m JoinCond)
-> Data JoinCond
JoinCond -> DataType
JoinCond -> Constr
(forall b. Data b => b -> b) -> JoinCond -> JoinCond
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinCond -> c JoinCond
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinCond
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> JoinCond -> u
forall u. (forall d. Data d => d -> u) -> JoinCond -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinCond -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinCond -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JoinCond -> m JoinCond
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinCond -> m JoinCond
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinCond
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinCond -> c JoinCond
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JoinCond)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinCond)
$cJoinUsing :: Constr
$cJoinOn :: Constr
$tJoinCond :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> JoinCond -> m JoinCond
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinCond -> m JoinCond
gmapMp :: (forall d. Data d => d -> m d) -> JoinCond -> m JoinCond
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> JoinCond -> m JoinCond
gmapM :: (forall d. Data d => d -> m d) -> JoinCond -> m JoinCond
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> JoinCond -> m JoinCond
gmapQi :: Int -> (forall d. Data d => d -> u) -> JoinCond -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> JoinCond -> u
gmapQ :: (forall d. Data d => d -> u) -> JoinCond -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> JoinCond -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinCond -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> JoinCond -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinCond -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> JoinCond -> r
gmapT :: (forall b. Data b => b -> b) -> JoinCond -> JoinCond
$cgmapT :: (forall b. Data b => b -> b) -> JoinCond -> JoinCond
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinCond)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c JoinCond)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c JoinCond)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c JoinCond)
dataTypeOf :: JoinCond -> DataType
$cdataTypeOf :: JoinCond -> DataType
toConstr :: JoinCond -> Constr
$ctoConstr :: JoinCond -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinCond
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c JoinCond
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinCond -> c JoinCond
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> JoinCond -> c JoinCond
$cp1Data :: Typeable JoinCond
Data)
instance NFData JoinCond
instance Cacheable JoinCond
instance Hashable JoinCond
instance ToSQL JoinCond where
toSQL :: JoinCond -> Builder
toSQL (JoinOn BoolExp
be) =
Builder
"ON" Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (BoolExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL BoolExp
be)
toSQL (JoinUsing [Identifier]
cols) =
Builder
"USING" Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (Text
"," Text -> [Identifier] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [Identifier]
cols)
data BoolExp
= BELit Bool
| BEBin BinOp BoolExp BoolExp
| BENot BoolExp
| BECompare CompareOp SQLExp SQLExp
|
BECompareAny CompareOp SQLExp SQLExp
| BENull SQLExp
| BENotNull SQLExp
| BEExists Select
| BEIN SQLExp [SQLExp]
| BEExp SQLExp
deriving (Int -> BoolExp -> ShowS
[BoolExp] -> ShowS
BoolExp -> String
(Int -> BoolExp -> ShowS)
-> (BoolExp -> String) -> ([BoolExp] -> ShowS) -> Show BoolExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BoolExp] -> ShowS
$cshowList :: [BoolExp] -> ShowS
show :: BoolExp -> String
$cshow :: BoolExp -> String
showsPrec :: Int -> BoolExp -> ShowS
$cshowsPrec :: Int -> BoolExp -> ShowS
Show, BoolExp -> BoolExp -> Bool
(BoolExp -> BoolExp -> Bool)
-> (BoolExp -> BoolExp -> Bool) -> Eq BoolExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BoolExp -> BoolExp -> Bool
$c/= :: BoolExp -> BoolExp -> Bool
== :: BoolExp -> BoolExp -> Bool
$c== :: BoolExp -> BoolExp -> Bool
Eq, (forall x. BoolExp -> Rep BoolExp x)
-> (forall x. Rep BoolExp x -> BoolExp) -> Generic BoolExp
forall x. Rep BoolExp x -> BoolExp
forall x. BoolExp -> Rep BoolExp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BoolExp x -> BoolExp
$cfrom :: forall x. BoolExp -> Rep BoolExp x
Generic, Typeable BoolExp
DataType
Constr
Typeable BoolExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BoolExp -> c BoolExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BoolExp)
-> (BoolExp -> Constr)
-> (BoolExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BoolExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BoolExp))
-> ((forall b. Data b => b -> b) -> BoolExp -> BoolExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BoolExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BoolExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> BoolExp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> BoolExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BoolExp -> m BoolExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoolExp -> m BoolExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoolExp -> m BoolExp)
-> Data BoolExp
BoolExp -> DataType
BoolExp -> Constr
(forall b. Data b => b -> b) -> BoolExp -> BoolExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BoolExp -> c BoolExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BoolExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BoolExp -> u
forall u. (forall d. Data d => d -> u) -> BoolExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BoolExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BoolExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BoolExp -> m BoolExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoolExp -> m BoolExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BoolExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BoolExp -> c BoolExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BoolExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BoolExp)
$cBEExp :: Constr
$cBEIN :: Constr
$cBEExists :: Constr
$cBENotNull :: Constr
$cBENull :: Constr
$cBECompareAny :: Constr
$cBECompare :: Constr
$cBENot :: Constr
$cBEBin :: Constr
$cBELit :: Constr
$tBoolExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> BoolExp -> m BoolExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoolExp -> m BoolExp
gmapMp :: (forall d. Data d => d -> m d) -> BoolExp -> m BoolExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BoolExp -> m BoolExp
gmapM :: (forall d. Data d => d -> m d) -> BoolExp -> m BoolExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BoolExp -> m BoolExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> BoolExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BoolExp -> u
gmapQ :: (forall d. Data d => d -> u) -> BoolExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BoolExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BoolExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> BoolExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BoolExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> BoolExp -> r
gmapT :: (forall b. Data b => b -> b) -> BoolExp -> BoolExp
$cgmapT :: (forall b. Data b => b -> b) -> BoolExp -> BoolExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BoolExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BoolExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c BoolExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BoolExp)
dataTypeOf :: BoolExp -> DataType
$cdataTypeOf :: BoolExp -> DataType
toConstr :: BoolExp -> Constr
$ctoConstr :: BoolExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BoolExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BoolExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BoolExp -> c BoolExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BoolExp -> c BoolExp
$cp1Data :: Typeable BoolExp
Data)
instance NFData BoolExp
instance Cacheable BoolExp
instance Hashable BoolExp
simplifyBoolExp :: BoolExp -> BoolExp
simplifyBoolExp :: BoolExp -> BoolExp
simplifyBoolExp BoolExp
be = case BoolExp
be of
BEBin BinOp
AndOp BoolExp
e1 BoolExp
e2 ->
let e1s :: BoolExp
e1s = BoolExp -> BoolExp
simplifyBoolExp BoolExp
e1
e2s :: BoolExp
e2s = BoolExp -> BoolExp
simplifyBoolExp BoolExp
e2
in if
| BoolExp
e1s BoolExp -> BoolExp -> Bool
forall a. Eq a => a -> a -> Bool
== Bool -> BoolExp
BELit Bool
True -> BoolExp
e2s
| BoolExp
e2s BoolExp -> BoolExp -> Bool
forall a. Eq a => a -> a -> Bool
== Bool -> BoolExp
BELit Bool
True -> BoolExp
e1s
| Bool
otherwise -> BinOp -> BoolExp -> BoolExp -> BoolExp
BEBin BinOp
AndOp BoolExp
e1s BoolExp
e2s
BEBin BinOp
OrOp BoolExp
e1 BoolExp
e2 ->
let e1s :: BoolExp
e1s = BoolExp -> BoolExp
simplifyBoolExp BoolExp
e1
e2s :: BoolExp
e2s = BoolExp -> BoolExp
simplifyBoolExp BoolExp
e2
in if
| BoolExp
e1s BoolExp -> BoolExp -> Bool
forall a. Eq a => a -> a -> Bool
== Bool -> BoolExp
BELit Bool
False -> BoolExp
e2s
| BoolExp
e2s BoolExp -> BoolExp -> Bool
forall a. Eq a => a -> a -> Bool
== Bool -> BoolExp
BELit Bool
False -> BoolExp
e1s
| Bool
otherwise -> BinOp -> BoolExp -> BoolExp -> BoolExp
BEBin BinOp
OrOp BoolExp
e1s BoolExp
e2s
BoolExp
e -> BoolExp
e
mkExists :: FromItem -> BoolExp -> BoolExp
mkExists :: FromItem -> BoolExp -> BoolExp
mkExists FromItem
fromItem BoolExp
whereFrag =
Select -> BoolExp
BEExists
Select
mkSelect
{ selExtr :: [Extractor]
selExtr = [SQLExp -> Maybe ColumnAlias -> Extractor
Extractor (Text -> SQLExp
SEUnsafe Text
"1") Maybe ColumnAlias
forall a. Maybe a
Nothing],
selFrom :: Maybe FromExp
selFrom = FromExp -> Maybe FromExp
forall a. a -> Maybe a
Just (FromExp -> Maybe FromExp) -> FromExp -> Maybe FromExp
forall a b. (a -> b) -> a -> b
$ [FromItem] -> FromExp
FromExp ([FromItem] -> FromExp) -> [FromItem] -> FromExp
forall a b. (a -> b) -> a -> b
$ FromItem -> [FromItem]
forall (f :: * -> *) a. Applicative f => a -> f a
pure FromItem
fromItem,
selWhere :: Maybe WhereFrag
selWhere = WhereFrag -> Maybe WhereFrag
forall a. a -> Maybe a
Just (WhereFrag -> Maybe WhereFrag) -> WhereFrag -> Maybe WhereFrag
forall a b. (a -> b) -> a -> b
$ BoolExp -> WhereFrag
WhereFrag BoolExp
whereFrag
}
instance ToSQL BoolExp where
toSQL :: BoolExp -> Builder
toSQL (BELit Bool
True) = Text -> Builder
TB.text Text
"'true'"
toSQL (BELit Bool
False) = Text -> Builder
TB.text Text
"'false'"
toSQL (BEBin BinOp
bo BoolExp
bel BoolExp
ber) =
Builder -> Builder
parenB (BoolExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL BoolExp
bel) Builder -> Builder -> Builder
<~> BinOp -> Builder
forall a. ToSQL a => a -> Builder
toSQL BinOp
bo Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (BoolExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL BoolExp
ber)
toSQL (BENot BoolExp
be) =
Builder
"NOT" Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (BoolExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL BoolExp
be)
toSQL (BECompare CompareOp
co SQLExp
vl SQLExp
vr) =
Builder -> Builder
parenB (SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
vl) Builder -> Builder -> Builder
<~> CompareOp -> Builder
forall a. ToSQL a => a -> Builder
toSQL CompareOp
co Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
vr)
toSQL (BECompareAny CompareOp
co SQLExp
vl SQLExp
vr) =
Builder -> Builder
parenB (SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
vl) Builder -> Builder -> Builder
<~> CompareOp -> Builder
forall a. ToSQL a => a -> Builder
toSQL CompareOp
co Builder -> Builder -> Builder
<~> Builder
"ANY" Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> Builder -> Builder
parenB (SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
vr)
toSQL (BENull SQLExp
v) =
Builder -> Builder
parenB (SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
v) Builder -> Builder -> Builder
<~> Builder
"IS NULL"
toSQL (BENotNull SQLExp
v) =
Builder -> Builder
parenB (SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
v) Builder -> Builder -> Builder
<~> Builder
"IS NOT NULL"
toSQL (BEExists Select
sel) =
Builder
"EXISTS " Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (Select -> Builder
forall a. ToSQL a => a -> Builder
toSQL Select
sel)
toSQL (BEIN SQLExp
vl [SQLExp]
exps) =
Builder -> Builder
parenB (SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
vl) Builder -> Builder -> Builder
<~> CompareOp -> Builder
forall a. ToSQL a => a -> Builder
toSQL CompareOp
SIN Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (Text
", " Text -> [SQLExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [SQLExp]
exps)
toSQL (BEExp SQLExp
e) = Builder -> Builder
parenB (Builder -> Builder) -> Builder -> Builder
forall a b. (a -> b) -> a -> b
$ SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
e
data BinOp = AndOp | OrOp
deriving (Int -> BinOp -> ShowS
[BinOp] -> ShowS
BinOp -> String
(Int -> BinOp -> ShowS)
-> (BinOp -> String) -> ([BinOp] -> ShowS) -> Show BinOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BinOp] -> ShowS
$cshowList :: [BinOp] -> ShowS
show :: BinOp -> String
$cshow :: BinOp -> String
showsPrec :: Int -> BinOp -> ShowS
$cshowsPrec :: Int -> BinOp -> ShowS
Show, BinOp -> BinOp -> Bool
(BinOp -> BinOp -> Bool) -> (BinOp -> BinOp -> Bool) -> Eq BinOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BinOp -> BinOp -> Bool
$c/= :: BinOp -> BinOp -> Bool
== :: BinOp -> BinOp -> Bool
$c== :: BinOp -> BinOp -> Bool
Eq, (forall x. BinOp -> Rep BinOp x)
-> (forall x. Rep BinOp x -> BinOp) -> Generic BinOp
forall x. Rep BinOp x -> BinOp
forall x. BinOp -> Rep BinOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BinOp x -> BinOp
$cfrom :: forall x. BinOp -> Rep BinOp x
Generic, Typeable BinOp
DataType
Constr
Typeable BinOp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BinOp -> c BinOp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BinOp)
-> (BinOp -> Constr)
-> (BinOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BinOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BinOp))
-> ((forall b. Data b => b -> b) -> BinOp -> BinOp)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> BinOp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> BinOp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BinOp -> m BinOp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BinOp -> m BinOp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BinOp -> m BinOp)
-> Data BinOp
BinOp -> DataType
BinOp -> Constr
(forall b. Data b => b -> b) -> BinOp -> BinOp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BinOp -> c BinOp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BinOp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> BinOp -> u
forall u. (forall d. Data d => d -> u) -> BinOp -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BinOp -> m BinOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BinOp -> m BinOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BinOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BinOp -> c BinOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BinOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BinOp)
$cOrOp :: Constr
$cAndOp :: Constr
$tBinOp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> BinOp -> m BinOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BinOp -> m BinOp
gmapMp :: (forall d. Data d => d -> m d) -> BinOp -> m BinOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> BinOp -> m BinOp
gmapM :: (forall d. Data d => d -> m d) -> BinOp -> m BinOp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> BinOp -> m BinOp
gmapQi :: Int -> (forall d. Data d => d -> u) -> BinOp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> BinOp -> u
gmapQ :: (forall d. Data d => d -> u) -> BinOp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> BinOp -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BinOp -> r
gmapT :: (forall b. Data b => b -> b) -> BinOp -> BinOp
$cgmapT :: (forall b. Data b => b -> b) -> BinOp -> BinOp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BinOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c BinOp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c BinOp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c BinOp)
dataTypeOf :: BinOp -> DataType
$cdataTypeOf :: BinOp -> DataType
toConstr :: BinOp -> Constr
$ctoConstr :: BinOp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BinOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c BinOp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BinOp -> c BinOp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> BinOp -> c BinOp
$cp1Data :: Typeable BinOp
Data)
instance NFData BinOp
instance Cacheable BinOp
instance Hashable BinOp
instance ToSQL BinOp where
toSQL :: BinOp -> Builder
toSQL BinOp
AndOp = Builder
"AND"
toSQL BinOp
OrOp = Builder
"OR"
data CompareOp
= SEQ
| SGT
| SLT
| SIN
| SNE
| SGTE
| SLTE
| SNIN
| SLIKE
| SNLIKE
| SILIKE
| SNILIKE
| SSIMILAR
| SNSIMILAR
| SREGEX
| SIREGEX
| SNREGEX
| SNIREGEX
| SContains
| SContainedIn
| SHasKey
| SHasKeysAny
| SHasKeysAll
| SMatchesFulltext
deriving (CompareOp -> CompareOp -> Bool
(CompareOp -> CompareOp -> Bool)
-> (CompareOp -> CompareOp -> Bool) -> Eq CompareOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompareOp -> CompareOp -> Bool
$c/= :: CompareOp -> CompareOp -> Bool
== :: CompareOp -> CompareOp -> Bool
$c== :: CompareOp -> CompareOp -> Bool
Eq, (forall x. CompareOp -> Rep CompareOp x)
-> (forall x. Rep CompareOp x -> CompareOp) -> Generic CompareOp
forall x. Rep CompareOp x -> CompareOp
forall x. CompareOp -> Rep CompareOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompareOp x -> CompareOp
$cfrom :: forall x. CompareOp -> Rep CompareOp x
Generic, Typeable CompareOp
DataType
Constr
Typeable CompareOp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompareOp -> c CompareOp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompareOp)
-> (CompareOp -> Constr)
-> (CompareOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompareOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompareOp))
-> ((forall b. Data b => b -> b) -> CompareOp -> CompareOp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompareOp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompareOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> CompareOp -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> CompareOp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompareOp -> m CompareOp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompareOp -> m CompareOp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompareOp -> m CompareOp)
-> Data CompareOp
CompareOp -> DataType
CompareOp -> Constr
(forall b. Data b => b -> b) -> CompareOp -> CompareOp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompareOp -> c CompareOp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompareOp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CompareOp -> u
forall u. (forall d. Data d => d -> u) -> CompareOp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompareOp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompareOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompareOp -> m CompareOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompareOp -> m CompareOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompareOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompareOp -> c CompareOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompareOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompareOp)
$cSMatchesFulltext :: Constr
$cSHasKeysAll :: Constr
$cSHasKeysAny :: Constr
$cSHasKey :: Constr
$cSContainedIn :: Constr
$cSContains :: Constr
$cSNIREGEX :: Constr
$cSNREGEX :: Constr
$cSIREGEX :: Constr
$cSREGEX :: Constr
$cSNSIMILAR :: Constr
$cSSIMILAR :: Constr
$cSNILIKE :: Constr
$cSILIKE :: Constr
$cSNLIKE :: Constr
$cSLIKE :: Constr
$cSNIN :: Constr
$cSLTE :: Constr
$cSGTE :: Constr
$cSNE :: Constr
$cSIN :: Constr
$cSLT :: Constr
$cSGT :: Constr
$cSEQ :: Constr
$tCompareOp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> CompareOp -> m CompareOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompareOp -> m CompareOp
gmapMp :: (forall d. Data d => d -> m d) -> CompareOp -> m CompareOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CompareOp -> m CompareOp
gmapM :: (forall d. Data d => d -> m d) -> CompareOp -> m CompareOp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CompareOp -> m CompareOp
gmapQi :: Int -> (forall d. Data d => d -> u) -> CompareOp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CompareOp -> u
gmapQ :: (forall d. Data d => d -> u) -> CompareOp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CompareOp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompareOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CompareOp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompareOp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CompareOp -> r
gmapT :: (forall b. Data b => b -> b) -> CompareOp -> CompareOp
$cgmapT :: (forall b. Data b => b -> b) -> CompareOp -> CompareOp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompareOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CompareOp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c CompareOp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CompareOp)
dataTypeOf :: CompareOp -> DataType
$cdataTypeOf :: CompareOp -> DataType
toConstr :: CompareOp -> Constr
$ctoConstr :: CompareOp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompareOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CompareOp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompareOp -> c CompareOp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CompareOp -> c CompareOp
$cp1Data :: Typeable CompareOp
Data)
instance NFData CompareOp
instance Cacheable CompareOp
instance Hashable CompareOp
instance Show CompareOp where
show :: CompareOp -> String
show = \case
CompareOp
SEQ -> String
"="
CompareOp
SGT -> String
">"
CompareOp
SLT -> String
"<"
CompareOp
SIN -> String
"IN"
CompareOp
SNE -> String
"<>"
CompareOp
SGTE -> String
">="
CompareOp
SLTE -> String
"<="
CompareOp
SNIN -> String
"NOT IN"
CompareOp
SLIKE -> String
"LIKE"
CompareOp
SNLIKE -> String
"NOT LIKE"
CompareOp
SILIKE -> String
"ILIKE"
CompareOp
SNILIKE -> String
"NOT ILIKE"
CompareOp
SSIMILAR -> String
"SIMILAR TO"
CompareOp
SNSIMILAR -> String
"NOT SIMILAR TO"
CompareOp
SREGEX -> String
"~"
CompareOp
SIREGEX -> String
"~*"
CompareOp
SNREGEX -> String
"!~"
CompareOp
SNIREGEX -> String
"!~*"
CompareOp
SContains -> String
"@>"
CompareOp
SContainedIn -> String
"<@"
CompareOp
SHasKey -> String
"?"
CompareOp
SHasKeysAny -> String
"?|"
CompareOp
SHasKeysAll -> String
"?&"
CompareOp
SMatchesFulltext -> String
"@"
instance ToSQL CompareOp where
toSQL :: CompareOp -> Builder
toSQL = String -> Builder
forall a. IsString a => String -> a
fromString (String -> Builder)
-> (CompareOp -> String) -> CompareOp -> Builder
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CompareOp -> String
forall a. Show a => a -> String
show
data SQLDelete = SQLDelete
{ SQLDelete -> QualifiedTable
delTable :: QualifiedTable,
SQLDelete -> Maybe UsingExp
delUsing :: Maybe UsingExp,
SQLDelete -> Maybe WhereFrag
delWhere :: Maybe WhereFrag,
SQLDelete -> Maybe RetExp
delRet :: Maybe RetExp
}
deriving (Int -> SQLDelete -> ShowS
[SQLDelete] -> ShowS
SQLDelete -> String
(Int -> SQLDelete -> ShowS)
-> (SQLDelete -> String)
-> ([SQLDelete] -> ShowS)
-> Show SQLDelete
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SQLDelete] -> ShowS
$cshowList :: [SQLDelete] -> ShowS
show :: SQLDelete -> String
$cshow :: SQLDelete -> String
showsPrec :: Int -> SQLDelete -> ShowS
$cshowsPrec :: Int -> SQLDelete -> ShowS
Show, SQLDelete -> SQLDelete -> Bool
(SQLDelete -> SQLDelete -> Bool)
-> (SQLDelete -> SQLDelete -> Bool) -> Eq SQLDelete
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SQLDelete -> SQLDelete -> Bool
$c/= :: SQLDelete -> SQLDelete -> Bool
== :: SQLDelete -> SQLDelete -> Bool
$c== :: SQLDelete -> SQLDelete -> Bool
Eq)
data SQLUpdate = SQLUpdate
{ SQLUpdate -> QualifiedTable
upTable :: QualifiedTable,
SQLUpdate -> SetExp
upSet :: SetExp,
SQLUpdate -> Maybe FromExp
upFrom :: Maybe FromExp,
SQLUpdate -> Maybe WhereFrag
upWhere :: Maybe WhereFrag,
SQLUpdate -> Maybe RetExp
upRet :: Maybe RetExp
}
deriving (Int -> SQLUpdate -> ShowS
[SQLUpdate] -> ShowS
SQLUpdate -> String
(Int -> SQLUpdate -> ShowS)
-> (SQLUpdate -> String)
-> ([SQLUpdate] -> ShowS)
-> Show SQLUpdate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SQLUpdate] -> ShowS
$cshowList :: [SQLUpdate] -> ShowS
show :: SQLUpdate -> String
$cshow :: SQLUpdate -> String
showsPrec :: Int -> SQLUpdate -> ShowS
$cshowsPrec :: Int -> SQLUpdate -> ShowS
Show, SQLUpdate -> SQLUpdate -> Bool
(SQLUpdate -> SQLUpdate -> Bool)
-> (SQLUpdate -> SQLUpdate -> Bool) -> Eq SQLUpdate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SQLUpdate -> SQLUpdate -> Bool
$c/= :: SQLUpdate -> SQLUpdate -> Bool
== :: SQLUpdate -> SQLUpdate -> Bool
$c== :: SQLUpdate -> SQLUpdate -> Bool
Eq)
newtype SetExp = SetExp [SetExpItem]
deriving (Int -> SetExp -> ShowS
[SetExp] -> ShowS
SetExp -> String
(Int -> SetExp -> ShowS)
-> (SetExp -> String) -> ([SetExp] -> ShowS) -> Show SetExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetExp] -> ShowS
$cshowList :: [SetExp] -> ShowS
show :: SetExp -> String
$cshow :: SetExp -> String
showsPrec :: Int -> SetExp -> ShowS
$cshowsPrec :: Int -> SetExp -> ShowS
Show, SetExp -> SetExp -> Bool
(SetExp -> SetExp -> Bool)
-> (SetExp -> SetExp -> Bool) -> Eq SetExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetExp -> SetExp -> Bool
$c/= :: SetExp -> SetExp -> Bool
== :: SetExp -> SetExp -> Bool
$c== :: SetExp -> SetExp -> Bool
Eq)
newtype SetExpItem = SetExpItem (PGCol, SQLExp)
deriving (Int -> SetExpItem -> ShowS
[SetExpItem] -> ShowS
SetExpItem -> String
(Int -> SetExpItem -> ShowS)
-> (SetExpItem -> String)
-> ([SetExpItem] -> ShowS)
-> Show SetExpItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SetExpItem] -> ShowS
$cshowList :: [SetExpItem] -> ShowS
show :: SetExpItem -> String
$cshow :: SetExpItem -> String
showsPrec :: Int -> SetExpItem -> ShowS
$cshowsPrec :: Int -> SetExpItem -> ShowS
Show, SetExpItem -> SetExpItem -> Bool
(SetExpItem -> SetExpItem -> Bool)
-> (SetExpItem -> SetExpItem -> Bool) -> Eq SetExpItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SetExpItem -> SetExpItem -> Bool
$c/= :: SetExpItem -> SetExpItem -> Bool
== :: SetExpItem -> SetExpItem -> Bool
$c== :: SetExpItem -> SetExpItem -> Bool
Eq)
buildUpsertSetExp ::
[PGCol] ->
HM.HashMap PGCol SQLExp ->
SetExp
buildUpsertSetExp :: [PGCol] -> HashMap PGCol SQLExp -> SetExp
buildUpsertSetExp [PGCol]
cols HashMap PGCol SQLExp
preSet =
[SetExpItem] -> SetExp
SetExp ([SetExpItem] -> SetExp) -> [SetExpItem] -> SetExp
forall a b. (a -> b) -> a -> b
$ ((PGCol, SQLExp) -> SetExpItem)
-> [(PGCol, SQLExp)] -> [SetExpItem]
forall a b. (a -> b) -> [a] -> [b]
map (PGCol, SQLExp) -> SetExpItem
SetExpItem ([(PGCol, SQLExp)] -> [SetExpItem])
-> [(PGCol, SQLExp)] -> [SetExpItem]
forall a b. (a -> b) -> a -> b
$ HashMap PGCol SQLExp -> [(PGCol, SQLExp)]
forall k v. HashMap k v -> [(k, v)]
HM.toList HashMap PGCol SQLExp
setExps
where
setExps :: HashMap PGCol SQLExp
setExps = HashMap PGCol SQLExp
-> HashMap PGCol SQLExp -> HashMap PGCol SQLExp
forall k v.
(Eq k, Hashable k) =>
HashMap k v -> HashMap k v -> HashMap k v
HM.union HashMap PGCol SQLExp
preSet (HashMap PGCol SQLExp -> HashMap PGCol SQLExp)
-> HashMap PGCol SQLExp -> HashMap PGCol SQLExp
forall a b. (a -> b) -> a -> b
$
[(PGCol, SQLExp)] -> HashMap PGCol SQLExp
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
HM.fromList ([(PGCol, SQLExp)] -> HashMap PGCol SQLExp)
-> [(PGCol, SQLExp)] -> HashMap PGCol SQLExp
forall a b. (a -> b) -> a -> b
$
((PGCol -> (PGCol, SQLExp)) -> [PGCol] -> [(PGCol, SQLExp)])
-> [PGCol] -> (PGCol -> (PGCol, SQLExp)) -> [(PGCol, SQLExp)]
forall a b c. (a -> b -> c) -> b -> a -> c
flip (PGCol -> (PGCol, SQLExp)) -> [PGCol] -> [(PGCol, SQLExp)]
forall a b. (a -> b) -> [a] -> [b]
map [PGCol]
cols ((PGCol -> (PGCol, SQLExp)) -> [(PGCol, SQLExp)])
-> (PGCol -> (PGCol, SQLExp)) -> [(PGCol, SQLExp)]
forall a b. (a -> b) -> a -> b
$ \PGCol
col ->
(PGCol
col, Identifier -> SQLExp
SEExcluded (Identifier -> SQLExp) -> Identifier -> SQLExp
forall a b. (a -> b) -> a -> b
$ PGCol -> Identifier
forall a. IsIdentifier a => a -> Identifier
toIdentifier PGCol
col)
newtype UsingExp = UsingExp [TableName]
deriving (Int -> UsingExp -> ShowS
[UsingExp] -> ShowS
UsingExp -> String
(Int -> UsingExp -> ShowS)
-> (UsingExp -> String) -> ([UsingExp] -> ShowS) -> Show UsingExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsingExp] -> ShowS
$cshowList :: [UsingExp] -> ShowS
show :: UsingExp -> String
$cshow :: UsingExp -> String
showsPrec :: Int -> UsingExp -> ShowS
$cshowsPrec :: Int -> UsingExp -> ShowS
Show, UsingExp -> UsingExp -> Bool
(UsingExp -> UsingExp -> Bool)
-> (UsingExp -> UsingExp -> Bool) -> Eq UsingExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsingExp -> UsingExp -> Bool
$c/= :: UsingExp -> UsingExp -> Bool
== :: UsingExp -> UsingExp -> Bool
$c== :: UsingExp -> UsingExp -> Bool
Eq)
instance ToSQL UsingExp where
toSQL :: UsingExp -> Builder
toSQL (UsingExp [TableName]
tables) =
Builder
"USING" Builder -> Builder -> Builder
<~> Text
"," Text -> [TableName] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [TableName]
tables
newtype RetExp = RetExp [Extractor]
deriving (Int -> RetExp -> ShowS
[RetExp] -> ShowS
RetExp -> String
(Int -> RetExp -> ShowS)
-> (RetExp -> String) -> ([RetExp] -> ShowS) -> Show RetExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RetExp] -> ShowS
$cshowList :: [RetExp] -> ShowS
show :: RetExp -> String
$cshow :: RetExp -> String
showsPrec :: Int -> RetExp -> ShowS
$cshowsPrec :: Int -> RetExp -> ShowS
Show, RetExp -> RetExp -> Bool
(RetExp -> RetExp -> Bool)
-> (RetExp -> RetExp -> Bool) -> Eq RetExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RetExp -> RetExp -> Bool
$c/= :: RetExp -> RetExp -> Bool
== :: RetExp -> RetExp -> Bool
$c== :: RetExp -> RetExp -> Bool
Eq)
selectStar :: Extractor
selectStar :: Extractor
selectStar = SQLExp -> Maybe ColumnAlias -> Extractor
Extractor (Maybe Qual -> SQLExp
SEStar Maybe Qual
forall a. Maybe a
Nothing) Maybe ColumnAlias
forall a. Maybe a
Nothing
selectStar' :: Qual -> Extractor
selectStar' :: Qual -> Extractor
selectStar' Qual
q = SQLExp -> Maybe ColumnAlias -> Extractor
Extractor (Maybe Qual -> SQLExp
SEStar (Qual -> Maybe Qual
forall a. a -> Maybe a
Just Qual
q)) Maybe ColumnAlias
forall a. Maybe a
Nothing
returningStar :: RetExp
returningStar :: RetExp
returningStar = [Extractor] -> RetExp
RetExp [Extractor
selectStar]
instance ToSQL RetExp where
toSQL :: RetExp -> Builder
toSQL (RetExp []) =
Builder
forall a. Monoid a => a
mempty
toSQL (RetExp [Extractor]
exps) =
Builder
"RETURNING" Builder -> Builder -> Builder
<~> (Text
", " Text -> [Extractor] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [Extractor]
exps)
instance ToSQL SQLDelete where
toSQL :: SQLDelete -> Builder
toSQL SQLDelete
sd =
Builder
"DELETE FROM"
Builder -> Builder -> Builder
<~> QualifiedTable -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLDelete -> QualifiedTable
delTable SQLDelete
sd)
Builder -> Builder -> Builder
<~> Maybe UsingExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLDelete -> Maybe UsingExp
delUsing SQLDelete
sd)
Builder -> Builder -> Builder
<~> Maybe WhereFrag -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLDelete -> Maybe WhereFrag
delWhere SQLDelete
sd)
Builder -> Builder -> Builder
<~> Maybe RetExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLDelete -> Maybe RetExp
delRet SQLDelete
sd)
instance ToSQL SQLUpdate where
toSQL :: SQLUpdate -> Builder
toSQL SQLUpdate
a =
Builder
"UPDATE"
Builder -> Builder -> Builder
<~> QualifiedTable -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLUpdate -> QualifiedTable
upTable SQLUpdate
a)
Builder -> Builder -> Builder
<~> SetExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLUpdate -> SetExp
upSet SQLUpdate
a)
Builder -> Builder -> Builder
<~> Maybe FromExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLUpdate -> Maybe FromExp
upFrom SQLUpdate
a)
Builder -> Builder -> Builder
<~> Maybe WhereFrag -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLUpdate -> Maybe WhereFrag
upWhere SQLUpdate
a)
Builder -> Builder -> Builder
<~> Maybe RetExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLUpdate -> Maybe RetExp
upRet SQLUpdate
a)
instance ToSQL SetExp where
toSQL :: SetExp -> Builder
toSQL (SetExp [SetExpItem]
cvs) =
Builder
"SET" Builder -> Builder -> Builder
<~> (Text
"," Text -> [SetExpItem] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [SetExpItem]
cvs)
instance ToSQL SetExpItem where
toSQL :: SetExpItem -> Builder
toSQL (SetExpItem (PGCol
col, SQLExp
val)) =
PGCol -> Builder
forall a. ToSQL a => a -> Builder
toSQL PGCol
col Builder -> Builder -> Builder
<~> Builder
"=" Builder -> Builder -> Builder
<~> SQLExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLExp
val
data SQLConflictTarget
= SQLColumn [PGCol]
| SQLConstraint ConstraintName
deriving (Int -> SQLConflictTarget -> ShowS
[SQLConflictTarget] -> ShowS
SQLConflictTarget -> String
(Int -> SQLConflictTarget -> ShowS)
-> (SQLConflictTarget -> String)
-> ([SQLConflictTarget] -> ShowS)
-> Show SQLConflictTarget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SQLConflictTarget] -> ShowS
$cshowList :: [SQLConflictTarget] -> ShowS
show :: SQLConflictTarget -> String
$cshow :: SQLConflictTarget -> String
showsPrec :: Int -> SQLConflictTarget -> ShowS
$cshowsPrec :: Int -> SQLConflictTarget -> ShowS
Show, SQLConflictTarget -> SQLConflictTarget -> Bool
(SQLConflictTarget -> SQLConflictTarget -> Bool)
-> (SQLConflictTarget -> SQLConflictTarget -> Bool)
-> Eq SQLConflictTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SQLConflictTarget -> SQLConflictTarget -> Bool
$c/= :: SQLConflictTarget -> SQLConflictTarget -> Bool
== :: SQLConflictTarget -> SQLConflictTarget -> Bool
$c== :: SQLConflictTarget -> SQLConflictTarget -> Bool
Eq)
instance ToSQL SQLConflictTarget where
toSQL :: SQLConflictTarget -> Builder
toSQL (SQLColumn [PGCol]
cols) =
Builder
"("
Builder -> Builder -> Builder
<~> (Text
"," Text -> [PGCol] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [PGCol]
cols)
Builder -> Builder -> Builder
<~> Builder
")"
toSQL (SQLConstraint ConstraintName
cons) = Builder
"ON CONSTRAINT" Builder -> Builder -> Builder
<~> ConstraintName -> Builder
forall a. ToSQL a => a -> Builder
toSQL ConstraintName
cons
data SQLConflict
= DoNothing (Maybe SQLConflictTarget)
| Update SQLConflictTarget SetExp (Maybe WhereFrag)
deriving (Int -> SQLConflict -> ShowS
[SQLConflict] -> ShowS
SQLConflict -> String
(Int -> SQLConflict -> ShowS)
-> (SQLConflict -> String)
-> ([SQLConflict] -> ShowS)
-> Show SQLConflict
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SQLConflict] -> ShowS
$cshowList :: [SQLConflict] -> ShowS
show :: SQLConflict -> String
$cshow :: SQLConflict -> String
showsPrec :: Int -> SQLConflict -> ShowS
$cshowsPrec :: Int -> SQLConflict -> ShowS
Show, SQLConflict -> SQLConflict -> Bool
(SQLConflict -> SQLConflict -> Bool)
-> (SQLConflict -> SQLConflict -> Bool) -> Eq SQLConflict
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SQLConflict -> SQLConflict -> Bool
$c/= :: SQLConflict -> SQLConflict -> Bool
== :: SQLConflict -> SQLConflict -> Bool
$c== :: SQLConflict -> SQLConflict -> Bool
Eq)
instance ToSQL SQLConflict where
toSQL :: SQLConflict -> Builder
toSQL (DoNothing Maybe SQLConflictTarget
Nothing) = Builder
"ON CONFLICT DO NOTHING"
toSQL (DoNothing (Just SQLConflictTarget
ct)) =
Builder
"ON CONFLICT"
Builder -> Builder -> Builder
<~> SQLConflictTarget -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLConflictTarget
ct
Builder -> Builder -> Builder
<~> Builder
"DO NOTHING"
toSQL (Update SQLConflictTarget
ct SetExp
set Maybe WhereFrag
whr) =
Builder
"ON CONFLICT"
Builder -> Builder -> Builder
<~> SQLConflictTarget -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLConflictTarget
ct
Builder -> Builder -> Builder
<~> Builder
"DO UPDATE"
Builder -> Builder -> Builder
<~> SetExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL SetExp
set
Builder -> Builder -> Builder
<~> Maybe WhereFrag -> Builder
forall a. ToSQL a => a -> Builder
toSQL Maybe WhereFrag
whr
newtype ValuesExp = ValuesExp {ValuesExp -> [TupleExp]
getValuesExp :: [TupleExp]}
deriving (Int -> ValuesExp -> ShowS
[ValuesExp] -> ShowS
ValuesExp -> String
(Int -> ValuesExp -> ShowS)
-> (ValuesExp -> String)
-> ([ValuesExp] -> ShowS)
-> Show ValuesExp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ValuesExp] -> ShowS
$cshowList :: [ValuesExp] -> ShowS
show :: ValuesExp -> String
$cshow :: ValuesExp -> String
showsPrec :: Int -> ValuesExp -> ShowS
$cshowsPrec :: Int -> ValuesExp -> ShowS
Show, ValuesExp -> ValuesExp -> Bool
(ValuesExp -> ValuesExp -> Bool)
-> (ValuesExp -> ValuesExp -> Bool) -> Eq ValuesExp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ValuesExp -> ValuesExp -> Bool
$c/= :: ValuesExp -> ValuesExp -> Bool
== :: ValuesExp -> ValuesExp -> Bool
$c== :: ValuesExp -> ValuesExp -> Bool
Eq, Typeable ValuesExp
DataType
Constr
Typeable ValuesExp
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ValuesExp -> c ValuesExp)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ValuesExp)
-> (ValuesExp -> Constr)
-> (ValuesExp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ValuesExp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ValuesExp))
-> ((forall b. Data b => b -> b) -> ValuesExp -> ValuesExp)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ValuesExp -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ValuesExp -> r)
-> (forall u. (forall d. Data d => d -> u) -> ValuesExp -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> ValuesExp -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp)
-> Data ValuesExp
ValuesExp -> DataType
ValuesExp -> Constr
(forall b. Data b => b -> b) -> ValuesExp -> ValuesExp
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ValuesExp -> c ValuesExp
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ValuesExp
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> ValuesExp -> u
forall u. (forall d. Data d => d -> u) -> ValuesExp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ValuesExp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ValuesExp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ValuesExp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ValuesExp -> c ValuesExp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ValuesExp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ValuesExp)
$cValuesExp :: Constr
$tValuesExp :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp
gmapMp :: (forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp
gmapM :: (forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> ValuesExp -> m ValuesExp
gmapQi :: Int -> (forall d. Data d => d -> u) -> ValuesExp -> u
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> ValuesExp -> u
gmapQ :: (forall d. Data d => d -> u) -> ValuesExp -> [u]
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> ValuesExp -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ValuesExp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> ValuesExp -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ValuesExp -> r
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> ValuesExp -> r
gmapT :: (forall b. Data b => b -> b) -> ValuesExp -> ValuesExp
$cgmapT :: (forall b. Data b => b -> b) -> ValuesExp -> ValuesExp
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ValuesExp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ValuesExp)
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c ValuesExp)
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c ValuesExp)
dataTypeOf :: ValuesExp -> DataType
$cdataTypeOf :: ValuesExp -> DataType
toConstr :: ValuesExp -> Constr
$ctoConstr :: ValuesExp -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ValuesExp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c ValuesExp
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ValuesExp -> c ValuesExp
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> ValuesExp -> c ValuesExp
$cp1Data :: Typeable ValuesExp
Data, ValuesExp -> ()
(ValuesExp -> ()) -> NFData ValuesExp
forall a. (a -> ()) -> NFData a
rnf :: ValuesExp -> ()
$crnf :: ValuesExp -> ()
NFData, Eq ValuesExp
Eq ValuesExp
-> (Accesses -> ValuesExp -> ValuesExp -> Bool)
-> Cacheable ValuesExp
Accesses -> ValuesExp -> ValuesExp -> Bool
forall a. Eq a -> (Accesses -> a -> a -> Bool) -> Cacheable a
unchanged :: Accesses -> ValuesExp -> ValuesExp -> Bool
$cunchanged :: Accesses -> ValuesExp -> ValuesExp -> Bool
$cp1Cacheable :: Eq ValuesExp
Cacheable, Int -> ValuesExp -> Int
ValuesExp -> Int
(Int -> ValuesExp -> Int)
-> (ValuesExp -> Int) -> Hashable ValuesExp
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: ValuesExp -> Int
$chash :: ValuesExp -> Int
hashWithSalt :: Int -> ValuesExp -> Int
$chashWithSalt :: Int -> ValuesExp -> Int
Hashable)
instance ToSQL ValuesExp where
toSQL :: ValuesExp -> Builder
toSQL (ValuesExp [TupleExp]
tuples) =
Builder
"VALUES" Builder -> Builder -> Builder
<~> (Text
", " Text -> [TupleExp] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> [TupleExp]
tuples)
data SQLInsert = SQLInsert
{ SQLInsert -> QualifiedTable
siTable :: QualifiedTable,
SQLInsert -> [PGCol]
siCols :: [PGCol],
SQLInsert -> ValuesExp
siValues :: ValuesExp,
SQLInsert -> Maybe SQLConflict
siConflict :: (Maybe SQLConflict),
SQLInsert -> Maybe RetExp
siRet :: (Maybe RetExp)
}
deriving (Int -> SQLInsert -> ShowS
[SQLInsert] -> ShowS
SQLInsert -> String
(Int -> SQLInsert -> ShowS)
-> (SQLInsert -> String)
-> ([SQLInsert] -> ShowS)
-> Show SQLInsert
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SQLInsert] -> ShowS
$cshowList :: [SQLInsert] -> ShowS
show :: SQLInsert -> String
$cshow :: SQLInsert -> String
showsPrec :: Int -> SQLInsert -> ShowS
$cshowsPrec :: Int -> SQLInsert -> ShowS
Show, SQLInsert -> SQLInsert -> Bool
(SQLInsert -> SQLInsert -> Bool)
-> (SQLInsert -> SQLInsert -> Bool) -> Eq SQLInsert
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SQLInsert -> SQLInsert -> Bool
$c/= :: SQLInsert -> SQLInsert -> Bool
== :: SQLInsert -> SQLInsert -> Bool
$c== :: SQLInsert -> SQLInsert -> Bool
Eq)
instance ToSQL SQLInsert where
toSQL :: SQLInsert -> Builder
toSQL SQLInsert
si =
Builder
"INSERT INTO"
Builder -> Builder -> Builder
<~> QualifiedTable -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLInsert -> QualifiedTable
siTable SQLInsert
si)
Builder -> Builder -> Builder
<~> ( if [PGCol] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null (SQLInsert -> [PGCol]
siCols SQLInsert
si)
then
Builder
"VALUES"
Builder -> Builder -> Builder
<~> Text
", " Text -> [Builder] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> (TupleExp -> Builder) -> [TupleExp] -> [Builder]
forall a b. (a -> b) -> [a] -> [b]
map (Builder -> TupleExp -> Builder
forall a b. a -> b -> a
const (Builder
"(DEFAULT)" :: TB.Builder)) (ValuesExp -> [TupleExp]
getValuesExp (SQLInsert -> ValuesExp
siValues SQLInsert
si))
else Builder
"(" Builder -> Builder -> Builder
<~> (Text
", " Text -> [PGCol] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> SQLInsert -> [PGCol]
siCols SQLInsert
si) Builder -> Builder -> Builder
<~> Builder
")" Builder -> Builder -> Builder
<~> ValuesExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLInsert -> ValuesExp
siValues SQLInsert
si)
)
Builder -> Builder -> Builder
<~> Builder -> (SQLConflict -> Builder) -> Maybe SQLConflict -> Builder
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Builder
"" SQLConflict -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLInsert -> Maybe SQLConflict
siConflict SQLInsert
si)
Builder -> Builder -> Builder
<~> Maybe RetExp -> Builder
forall a. ToSQL a => a -> Builder
toSQL (SQLInsert -> Maybe RetExp
siRet SQLInsert
si)
data TopLevelCTE
= CTESelect Select
| CTEInsert SQLInsert
| CTEUpdate SQLUpdate
| CTEDelete SQLDelete
deriving (Int -> TopLevelCTE -> ShowS
[TopLevelCTE] -> ShowS
TopLevelCTE -> String
(Int -> TopLevelCTE -> ShowS)
-> (TopLevelCTE -> String)
-> ([TopLevelCTE] -> ShowS)
-> Show TopLevelCTE
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TopLevelCTE] -> ShowS
$cshowList :: [TopLevelCTE] -> ShowS
show :: TopLevelCTE -> String
$cshow :: TopLevelCTE -> String
showsPrec :: Int -> TopLevelCTE -> ShowS
$cshowsPrec :: Int -> TopLevelCTE -> ShowS
Show, TopLevelCTE -> TopLevelCTE -> Bool
(TopLevelCTE -> TopLevelCTE -> Bool)
-> (TopLevelCTE -> TopLevelCTE -> Bool) -> Eq TopLevelCTE
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TopLevelCTE -> TopLevelCTE -> Bool
$c/= :: TopLevelCTE -> TopLevelCTE -> Bool
== :: TopLevelCTE -> TopLevelCTE -> Bool
$c== :: TopLevelCTE -> TopLevelCTE -> Bool
Eq)
instance ToSQL TopLevelCTE where
toSQL :: TopLevelCTE -> Builder
toSQL = \case
CTESelect Select
q -> Select -> Builder
forall a. ToSQL a => a -> Builder
toSQL Select
q
CTEInsert SQLInsert
q -> SQLInsert -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLInsert
q
CTEUpdate SQLUpdate
q -> SQLUpdate -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLUpdate
q
CTEDelete SQLDelete
q -> SQLDelete -> Builder
forall a. ToSQL a => a -> Builder
toSQL SQLDelete
q
data SelectWithG statement = SelectWith
{ SelectWithG statement -> [(TableAlias, statement)]
swCTEs :: [(TableAlias, statement)],
SelectWithG statement -> Select
swSelect :: Select
}
deriving (Int -> SelectWithG statement -> ShowS
[SelectWithG statement] -> ShowS
SelectWithG statement -> String
(Int -> SelectWithG statement -> ShowS)
-> (SelectWithG statement -> String)
-> ([SelectWithG statement] -> ShowS)
-> Show (SelectWithG statement)
forall statement.
Show statement =>
Int -> SelectWithG statement -> ShowS
forall statement.
Show statement =>
[SelectWithG statement] -> ShowS
forall statement. Show statement => SelectWithG statement -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SelectWithG statement] -> ShowS
$cshowList :: forall statement.
Show statement =>
[SelectWithG statement] -> ShowS
show :: SelectWithG statement -> String
$cshow :: forall statement. Show statement => SelectWithG statement -> String
showsPrec :: Int -> SelectWithG statement -> ShowS
$cshowsPrec :: forall statement.
Show statement =>
Int -> SelectWithG statement -> ShowS
Show, SelectWithG statement -> SelectWithG statement -> Bool
(SelectWithG statement -> SelectWithG statement -> Bool)
-> (SelectWithG statement -> SelectWithG statement -> Bool)
-> Eq (SelectWithG statement)
forall statement.
Eq statement =>
SelectWithG statement -> SelectWithG statement -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SelectWithG statement -> SelectWithG statement -> Bool
$c/= :: forall statement.
Eq statement =>
SelectWithG statement -> SelectWithG statement -> Bool
== :: SelectWithG statement -> SelectWithG statement -> Bool
$c== :: forall statement.
Eq statement =>
SelectWithG statement -> SelectWithG statement -> Bool
Eq, (forall x. SelectWithG statement -> Rep (SelectWithG statement) x)
-> (forall x.
Rep (SelectWithG statement) x -> SelectWithG statement)
-> Generic (SelectWithG statement)
forall x. Rep (SelectWithG statement) x -> SelectWithG statement
forall x. SelectWithG statement -> Rep (SelectWithG statement) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall statement x.
Rep (SelectWithG statement) x -> SelectWithG statement
forall statement x.
SelectWithG statement -> Rep (SelectWithG statement) x
$cto :: forall statement x.
Rep (SelectWithG statement) x -> SelectWithG statement
$cfrom :: forall statement x.
SelectWithG statement -> Rep (SelectWithG statement) x
Generic, Typeable (SelectWithG statement)
DataType
Constr
Typeable (SelectWithG statement)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SelectWithG statement
-> c (SelectWithG statement))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SelectWithG statement))
-> (SelectWithG statement -> Constr)
-> (SelectWithG statement -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (SelectWithG statement)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SelectWithG statement)))
-> ((forall b. Data b => b -> b)
-> SelectWithG statement -> SelectWithG statement)
-> (forall r r'.
(r -> r' -> r)
-> r
-> (forall d. Data d => d -> r')
-> SelectWithG statement
-> r)
-> (forall r r'.
(r' -> r -> r)
-> r
-> (forall d. Data d => d -> r')
-> SelectWithG statement
-> r)
-> (forall u.
(forall d. Data d => d -> u) -> SelectWithG statement -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> SelectWithG statement -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement))
-> Data (SelectWithG statement)
SelectWithG statement -> DataType
SelectWithG statement -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (SelectWithG statement))
(forall b. Data b => b -> b)
-> SelectWithG statement -> SelectWithG statement
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SelectWithG statement
-> c (SelectWithG statement)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SelectWithG statement)
forall statement.
Data statement =>
Typeable (SelectWithG statement)
forall statement.
Data statement =>
SelectWithG statement -> DataType
forall statement. Data statement => SelectWithG statement -> Constr
forall statement.
Data statement =>
(forall b. Data b => b -> b)
-> SelectWithG statement -> SelectWithG statement
forall statement u.
Data statement =>
Int -> (forall d. Data d => d -> u) -> SelectWithG statement -> u
forall statement u.
Data statement =>
(forall d. Data d => d -> u) -> SelectWithG statement -> [u]
forall statement r r'.
Data statement =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SelectWithG statement -> r
forall statement r r'.
Data statement =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SelectWithG statement -> r
forall statement (m :: * -> *).
(Data statement, Monad m) =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
forall statement (m :: * -> *).
(Data statement, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
forall statement (c :: * -> *).
Data statement =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SelectWithG statement)
forall statement (c :: * -> *).
Data statement =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SelectWithG statement
-> c (SelectWithG statement)
forall statement (t :: * -> *) (c :: * -> *).
(Data statement, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (SelectWithG statement))
forall statement (t :: * -> * -> *) (c :: * -> *).
(Data statement, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SelectWithG statement))
forall a.
Typeable a
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> SelectWithG statement -> u
forall u.
(forall d. Data d => d -> u) -> SelectWithG statement -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SelectWithG statement -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SelectWithG statement -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SelectWithG statement)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SelectWithG statement
-> c (SelectWithG statement)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (SelectWithG statement))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SelectWithG statement))
$cSelectWith :: Constr
$tSelectWithG :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
$cgmapMo :: forall statement (m :: * -> *).
(Data statement, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
gmapMp :: (forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
$cgmapMp :: forall statement (m :: * -> *).
(Data statement, MonadPlus m) =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
gmapM :: (forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
$cgmapM :: forall statement (m :: * -> *).
(Data statement, Monad m) =>
(forall d. Data d => d -> m d)
-> SelectWithG statement -> m (SelectWithG statement)
gmapQi :: Int -> (forall d. Data d => d -> u) -> SelectWithG statement -> u
$cgmapQi :: forall statement u.
Data statement =>
Int -> (forall d. Data d => d -> u) -> SelectWithG statement -> u
gmapQ :: (forall d. Data d => d -> u) -> SelectWithG statement -> [u]
$cgmapQ :: forall statement u.
Data statement =>
(forall d. Data d => d -> u) -> SelectWithG statement -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SelectWithG statement -> r
$cgmapQr :: forall statement r r'.
Data statement =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> SelectWithG statement -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SelectWithG statement -> r
$cgmapQl :: forall statement r r'.
Data statement =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> SelectWithG statement -> r
gmapT :: (forall b. Data b => b -> b)
-> SelectWithG statement -> SelectWithG statement
$cgmapT :: forall statement.
Data statement =>
(forall b. Data b => b -> b)
-> SelectWithG statement -> SelectWithG statement
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SelectWithG statement))
$cdataCast2 :: forall statement (t :: * -> * -> *) (c :: * -> *).
(Data statement, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (SelectWithG statement))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (SelectWithG statement))
$cdataCast1 :: forall statement (t :: * -> *) (c :: * -> *).
(Data statement, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (SelectWithG statement))
dataTypeOf :: SelectWithG statement -> DataType
$cdataTypeOf :: forall statement.
Data statement =>
SelectWithG statement -> DataType
toConstr :: SelectWithG statement -> Constr
$ctoConstr :: forall statement. Data statement => SelectWithG statement -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SelectWithG statement)
$cgunfold :: forall statement (c :: * -> *).
Data statement =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (SelectWithG statement)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SelectWithG statement
-> c (SelectWithG statement)
$cgfoldl :: forall statement (c :: * -> *).
Data statement =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g)
-> SelectWithG statement
-> c (SelectWithG statement)
$cp1Data :: forall statement.
Data statement =>
Typeable (SelectWithG statement)
Data)
instance (NFData v) => NFData (SelectWithG v)
instance (Cacheable v) => Cacheable (SelectWithG v)
instance (Hashable v) => Hashable (SelectWithG v)
instance (ToSQL v) => ToSQL (SelectWithG v) where
toSQL :: SelectWithG v -> Builder
toSQL (SelectWith [(TableAlias, v)]
ctes Select
sel) =
Builder
"WITH " Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> (Text
", " Text -> [Builder] -> Builder
forall a. ToSQL a => Text -> [a] -> Builder
<+> ((TableAlias, v) -> Builder) -> [(TableAlias, v)] -> [Builder]
forall a b. (a -> b) -> [a] -> [b]
map (TableAlias, v) -> Builder
forall a. ToSQL a => (TableAlias, a) -> Builder
f [(TableAlias, v)]
ctes) Builder -> Builder -> Builder
<~> Select -> Builder
forall a. ToSQL a => a -> Builder
toSQL Select
sel
where
f :: (TableAlias, a) -> Builder
f (TableAlias
al, a
q) = TableAlias -> Builder
tableAliasToSqlWithoutAs TableAlias
al Builder -> Builder -> Builder
<~> Builder
"AS" Builder -> Builder -> Builder
<~> Builder -> Builder
parenB (a -> Builder
forall a. ToSQL a => a -> Builder
toSQL a
q)
type SelectWith = SelectWithG TopLevelCTE
infixr 6 <+>
(<+>) :: (ToSQL a) => Text -> [a] -> TB.Builder
<+> :: Text -> [a] -> Builder
(<+>) Text
_ [] = Builder
forall a. Monoid a => a
mempty
(<+>) Text
kat (a
x : [a]
xs) =
a -> Builder
forall a. ToSQL a => a -> Builder
toSQL a
x Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> [Builder] -> Builder
forall a. Monoid a => [a] -> a
mconcat [Text -> Builder
TB.text Text
kat Builder -> Builder -> Builder
forall a. Semigroup a => a -> a -> a
<> a -> Builder
forall a. ToSQL a => a -> Builder
toSQL a
x' | a
x' <- [a]
xs]
{-# INLINE (<+>) #-}