module Opaleye.Internal.HaskellDB.PrimQuery where
import qualified Opaleye.Internal.Tag as T
import Data.ByteString (ByteString)
import qualified Data.List.NonEmpty as NEL
import qualified Data.Scientific as Sci
type TableName = String
type Attribute = String
type Name = String
type Scheme = [Attribute]
type Assoc = [(Attribute,PrimExpr)]
data Symbol = Symbol String T.Tag deriving (ReadPrec [Symbol]
ReadPrec Symbol
Int -> ReadS Symbol
ReadS [Symbol]
(Int -> ReadS Symbol)
-> ReadS [Symbol]
-> ReadPrec Symbol
-> ReadPrec [Symbol]
-> Read Symbol
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Symbol]
$creadListPrec :: ReadPrec [Symbol]
readPrec :: ReadPrec Symbol
$creadPrec :: ReadPrec Symbol
readList :: ReadS [Symbol]
$creadList :: ReadS [Symbol]
readsPrec :: Int -> ReadS Symbol
$creadsPrec :: Int -> ReadS Symbol
Read, Int -> Symbol -> ShowS
[Symbol] -> ShowS
Symbol -> String
(Int -> Symbol -> ShowS)
-> (Symbol -> String) -> ([Symbol] -> ShowS) -> Show Symbol
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Symbol] -> ShowS
$cshowList :: [Symbol] -> ShowS
show :: Symbol -> String
$cshow :: Symbol -> String
showsPrec :: Int -> Symbol -> ShowS
$cshowsPrec :: Int -> Symbol -> ShowS
Show)
data PrimExpr = AttrExpr Symbol
| BaseTableAttrExpr Attribute
| CompositeExpr PrimExpr Attribute
| BinExpr BinOp PrimExpr PrimExpr
| UnExpr UnOp PrimExpr
| AggrExpr AggrDistinct AggrOp PrimExpr [OrderExpr]
| ConstExpr Literal
| CaseExpr [(PrimExpr,PrimExpr)] PrimExpr
| ListExpr (NEL.NonEmpty PrimExpr)
| ParamExpr (Maybe Name) PrimExpr
| FunExpr Name [PrimExpr]
| CastExpr Name PrimExpr
| DefaultInsertExpr
| ArrayExpr [PrimExpr]
| RangeExpr String BoundExpr BoundExpr
| ArrayIndex PrimExpr PrimExpr
deriving (ReadPrec [PrimExpr]
ReadPrec PrimExpr
Int -> ReadS PrimExpr
ReadS [PrimExpr]
(Int -> ReadS PrimExpr)
-> ReadS [PrimExpr]
-> ReadPrec PrimExpr
-> ReadPrec [PrimExpr]
-> Read PrimExpr
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrimExpr]
$creadListPrec :: ReadPrec [PrimExpr]
readPrec :: ReadPrec PrimExpr
$creadPrec :: ReadPrec PrimExpr
readList :: ReadS [PrimExpr]
$creadList :: ReadS [PrimExpr]
readsPrec :: Int -> ReadS PrimExpr
$creadsPrec :: Int -> ReadS PrimExpr
Read,Int -> PrimExpr -> ShowS
[PrimExpr] -> ShowS
PrimExpr -> String
(Int -> PrimExpr -> ShowS)
-> (PrimExpr -> String) -> ([PrimExpr] -> ShowS) -> Show PrimExpr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrimExpr] -> ShowS
$cshowList :: [PrimExpr] -> ShowS
show :: PrimExpr -> String
$cshow :: PrimExpr -> String
showsPrec :: Int -> PrimExpr -> ShowS
$cshowsPrec :: Int -> PrimExpr -> ShowS
Show)
data Literal = NullLit
| DefaultLit
| BoolLit Bool
| StringLit String
| ByteStringLit ByteString
| IntegerLit Integer
| DoubleLit Double
| NumericLit Sci.Scientific
| OtherLit String
deriving (ReadPrec [Literal]
ReadPrec Literal
Int -> ReadS Literal
ReadS [Literal]
(Int -> ReadS Literal)
-> ReadS [Literal]
-> ReadPrec Literal
-> ReadPrec [Literal]
-> Read Literal
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Literal]
$creadListPrec :: ReadPrec [Literal]
readPrec :: ReadPrec Literal
$creadPrec :: ReadPrec Literal
readList :: ReadS [Literal]
$creadList :: ReadS [Literal]
readsPrec :: Int -> ReadS Literal
$creadsPrec :: Int -> ReadS Literal
Read,Int -> Literal -> ShowS
[Literal] -> ShowS
Literal -> String
(Int -> Literal -> ShowS)
-> (Literal -> String) -> ([Literal] -> ShowS) -> Show Literal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Literal] -> ShowS
$cshowList :: [Literal] -> ShowS
show :: Literal -> String
$cshow :: Literal -> String
showsPrec :: Int -> Literal -> ShowS
$cshowsPrec :: Int -> Literal -> ShowS
Show)
data BinOp = (:==) | (:<) | (:<=) | (:>) | (:>=) | (:<>)
| OpAnd | OpOr
| OpLike | OpILike | OpIn
| OpOther String
| (:||)
| (:+) | (:-) | (:*) | (:/) | OpMod
| (:~) | (:&) | (:|) | (:^)
| (:=) | OpAtTimeZone
| (:->) | (:->>) | (:#>) | (:#>>)
| (:@>) | (:<@) | (:?) | (:?|) | (:?&)
| (:&&) | (:<<) | (:>>) | (:&<) | (:&>) | (:-|-)
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,ReadPrec [BinOp]
ReadPrec BinOp
Int -> ReadS BinOp
ReadS [BinOp]
(Int -> ReadS BinOp)
-> ReadS [BinOp]
-> ReadPrec BinOp
-> ReadPrec [BinOp]
-> Read BinOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BinOp]
$creadListPrec :: ReadPrec [BinOp]
readPrec :: ReadPrec BinOp
$creadPrec :: ReadPrec BinOp
readList :: ReadS [BinOp]
$creadList :: ReadS [BinOp]
readsPrec :: Int -> ReadS BinOp
$creadsPrec :: Int -> ReadS BinOp
Read)
data UnOp = OpNot
| OpIsNull
| OpIsNotNull
| OpLength
| OpAbs
| OpNegate
| OpLower
| OpUpper
| UnOpOther String
deriving (Int -> UnOp -> ShowS
[UnOp] -> ShowS
UnOp -> String
(Int -> UnOp -> ShowS)
-> (UnOp -> String) -> ([UnOp] -> ShowS) -> Show UnOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnOp] -> ShowS
$cshowList :: [UnOp] -> ShowS
show :: UnOp -> String
$cshow :: UnOp -> String
showsPrec :: Int -> UnOp -> ShowS
$cshowsPrec :: Int -> UnOp -> ShowS
Show,ReadPrec [UnOp]
ReadPrec UnOp
Int -> ReadS UnOp
ReadS [UnOp]
(Int -> ReadS UnOp)
-> ReadS [UnOp] -> ReadPrec UnOp -> ReadPrec [UnOp] -> Read UnOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnOp]
$creadListPrec :: ReadPrec [UnOp]
readPrec :: ReadPrec UnOp
$creadPrec :: ReadPrec UnOp
readList :: ReadS [UnOp]
$creadList :: ReadS [UnOp]
readsPrec :: Int -> ReadS UnOp
$creadsPrec :: Int -> ReadS UnOp
Read)
data AggrOp = AggrCount | AggrSum | AggrAvg | AggrMin | AggrMax
| AggrStdDev | AggrStdDevP | AggrVar | AggrVarP
| AggrBoolOr | AggrBoolAnd | AggrArr | JsonArr
| AggrStringAggr PrimExpr
| AggrOther String
deriving (Int -> AggrOp -> ShowS
[AggrOp] -> ShowS
AggrOp -> String
(Int -> AggrOp -> ShowS)
-> (AggrOp -> String) -> ([AggrOp] -> ShowS) -> Show AggrOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggrOp] -> ShowS
$cshowList :: [AggrOp] -> ShowS
show :: AggrOp -> String
$cshow :: AggrOp -> String
showsPrec :: Int -> AggrOp -> ShowS
$cshowsPrec :: Int -> AggrOp -> ShowS
Show,ReadPrec [AggrOp]
ReadPrec AggrOp
Int -> ReadS AggrOp
ReadS [AggrOp]
(Int -> ReadS AggrOp)
-> ReadS [AggrOp]
-> ReadPrec AggrOp
-> ReadPrec [AggrOp]
-> Read AggrOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggrOp]
$creadListPrec :: ReadPrec [AggrOp]
readPrec :: ReadPrec AggrOp
$creadPrec :: ReadPrec AggrOp
readList :: ReadS [AggrOp]
$creadList :: ReadS [AggrOp]
readsPrec :: Int -> ReadS AggrOp
$creadsPrec :: Int -> ReadS AggrOp
Read)
data AggrDistinct = AggrDistinct | AggrAll
deriving (AggrDistinct -> AggrDistinct -> Bool
(AggrDistinct -> AggrDistinct -> Bool)
-> (AggrDistinct -> AggrDistinct -> Bool) -> Eq AggrDistinct
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggrDistinct -> AggrDistinct -> Bool
$c/= :: AggrDistinct -> AggrDistinct -> Bool
== :: AggrDistinct -> AggrDistinct -> Bool
$c== :: AggrDistinct -> AggrDistinct -> Bool
Eq,Int -> AggrDistinct -> ShowS
[AggrDistinct] -> ShowS
AggrDistinct -> String
(Int -> AggrDistinct -> ShowS)
-> (AggrDistinct -> String)
-> ([AggrDistinct] -> ShowS)
-> Show AggrDistinct
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggrDistinct] -> ShowS
$cshowList :: [AggrDistinct] -> ShowS
show :: AggrDistinct -> String
$cshow :: AggrDistinct -> String
showsPrec :: Int -> AggrDistinct -> ShowS
$cshowsPrec :: Int -> AggrDistinct -> ShowS
Show,ReadPrec [AggrDistinct]
ReadPrec AggrDistinct
Int -> ReadS AggrDistinct
ReadS [AggrDistinct]
(Int -> ReadS AggrDistinct)
-> ReadS [AggrDistinct]
-> ReadPrec AggrDistinct
-> ReadPrec [AggrDistinct]
-> Read AggrDistinct
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggrDistinct]
$creadListPrec :: ReadPrec [AggrDistinct]
readPrec :: ReadPrec AggrDistinct
$creadPrec :: ReadPrec AggrDistinct
readList :: ReadS [AggrDistinct]
$creadList :: ReadS [AggrDistinct]
readsPrec :: Int -> ReadS AggrDistinct
$creadsPrec :: Int -> ReadS AggrDistinct
Read)
data OrderExpr = OrderExpr OrderOp PrimExpr
deriving (Int -> OrderExpr -> ShowS
[OrderExpr] -> ShowS
OrderExpr -> String
(Int -> OrderExpr -> ShowS)
-> (OrderExpr -> String)
-> ([OrderExpr] -> ShowS)
-> Show OrderExpr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderExpr] -> ShowS
$cshowList :: [OrderExpr] -> ShowS
show :: OrderExpr -> String
$cshow :: OrderExpr -> String
showsPrec :: Int -> OrderExpr -> ShowS
$cshowsPrec :: Int -> OrderExpr -> ShowS
Show,ReadPrec [OrderExpr]
ReadPrec OrderExpr
Int -> ReadS OrderExpr
ReadS [OrderExpr]
(Int -> ReadS OrderExpr)
-> ReadS [OrderExpr]
-> ReadPrec OrderExpr
-> ReadPrec [OrderExpr]
-> Read OrderExpr
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrderExpr]
$creadListPrec :: ReadPrec [OrderExpr]
readPrec :: ReadPrec OrderExpr
$creadPrec :: ReadPrec OrderExpr
readList :: ReadS [OrderExpr]
$creadList :: ReadS [OrderExpr]
readsPrec :: Int -> ReadS OrderExpr
$creadsPrec :: Int -> ReadS OrderExpr
Read)
data OrderNulls = NullsFirst | NullsLast
deriving (Int -> OrderNulls -> ShowS
[OrderNulls] -> ShowS
OrderNulls -> String
(Int -> OrderNulls -> ShowS)
-> (OrderNulls -> String)
-> ([OrderNulls] -> ShowS)
-> Show OrderNulls
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderNulls] -> ShowS
$cshowList :: [OrderNulls] -> ShowS
show :: OrderNulls -> String
$cshow :: OrderNulls -> String
showsPrec :: Int -> OrderNulls -> ShowS
$cshowsPrec :: Int -> OrderNulls -> ShowS
Show,ReadPrec [OrderNulls]
ReadPrec OrderNulls
Int -> ReadS OrderNulls
ReadS [OrderNulls]
(Int -> ReadS OrderNulls)
-> ReadS [OrderNulls]
-> ReadPrec OrderNulls
-> ReadPrec [OrderNulls]
-> Read OrderNulls
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrderNulls]
$creadListPrec :: ReadPrec [OrderNulls]
readPrec :: ReadPrec OrderNulls
$creadPrec :: ReadPrec OrderNulls
readList :: ReadS [OrderNulls]
$creadList :: ReadS [OrderNulls]
readsPrec :: Int -> ReadS OrderNulls
$creadsPrec :: Int -> ReadS OrderNulls
Read)
data OrderDirection = OpAsc | OpDesc
deriving (Int -> OrderDirection -> ShowS
[OrderDirection] -> ShowS
OrderDirection -> String
(Int -> OrderDirection -> ShowS)
-> (OrderDirection -> String)
-> ([OrderDirection] -> ShowS)
-> Show OrderDirection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderDirection] -> ShowS
$cshowList :: [OrderDirection] -> ShowS
show :: OrderDirection -> String
$cshow :: OrderDirection -> String
showsPrec :: Int -> OrderDirection -> ShowS
$cshowsPrec :: Int -> OrderDirection -> ShowS
Show,ReadPrec [OrderDirection]
ReadPrec OrderDirection
Int -> ReadS OrderDirection
ReadS [OrderDirection]
(Int -> ReadS OrderDirection)
-> ReadS [OrderDirection]
-> ReadPrec OrderDirection
-> ReadPrec [OrderDirection]
-> Read OrderDirection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrderDirection]
$creadListPrec :: ReadPrec [OrderDirection]
readPrec :: ReadPrec OrderDirection
$creadPrec :: ReadPrec OrderDirection
readList :: ReadS [OrderDirection]
$creadList :: ReadS [OrderDirection]
readsPrec :: Int -> ReadS OrderDirection
$creadsPrec :: Int -> ReadS OrderDirection
Read)
data OrderOp = OrderOp { OrderOp -> OrderDirection
orderDirection :: OrderDirection
, OrderOp -> OrderNulls
orderNulls :: OrderNulls }
deriving (Int -> OrderOp -> ShowS
[OrderOp] -> ShowS
OrderOp -> String
(Int -> OrderOp -> ShowS)
-> (OrderOp -> String) -> ([OrderOp] -> ShowS) -> Show OrderOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrderOp] -> ShowS
$cshowList :: [OrderOp] -> ShowS
show :: OrderOp -> String
$cshow :: OrderOp -> String
showsPrec :: Int -> OrderOp -> ShowS
$cshowsPrec :: Int -> OrderOp -> ShowS
Show,ReadPrec [OrderOp]
ReadPrec OrderOp
Int -> ReadS OrderOp
ReadS [OrderOp]
(Int -> ReadS OrderOp)
-> ReadS [OrderOp]
-> ReadPrec OrderOp
-> ReadPrec [OrderOp]
-> Read OrderOp
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrderOp]
$creadListPrec :: ReadPrec [OrderOp]
readPrec :: ReadPrec OrderOp
$creadPrec :: ReadPrec OrderOp
readList :: ReadS [OrderOp]
$creadList :: ReadS [OrderOp]
readsPrec :: Int -> ReadS OrderOp
$creadsPrec :: Int -> ReadS OrderOp
Read)
data BoundExpr = Inclusive PrimExpr | Exclusive PrimExpr | PosInfinity | NegInfinity
deriving (Int -> BoundExpr -> ShowS
[BoundExpr] -> ShowS
BoundExpr -> String
(Int -> BoundExpr -> ShowS)
-> (BoundExpr -> String)
-> ([BoundExpr] -> ShowS)
-> Show BoundExpr
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BoundExpr] -> ShowS
$cshowList :: [BoundExpr] -> ShowS
show :: BoundExpr -> String
$cshow :: BoundExpr -> String
showsPrec :: Int -> BoundExpr -> ShowS
$cshowsPrec :: Int -> BoundExpr -> ShowS
Show,ReadPrec [BoundExpr]
ReadPrec BoundExpr
Int -> ReadS BoundExpr
ReadS [BoundExpr]
(Int -> ReadS BoundExpr)
-> ReadS [BoundExpr]
-> ReadPrec BoundExpr
-> ReadPrec [BoundExpr]
-> Read BoundExpr
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BoundExpr]
$creadListPrec :: ReadPrec [BoundExpr]
readPrec :: ReadPrec BoundExpr
$creadPrec :: ReadPrec BoundExpr
readList :: ReadS [BoundExpr]
$creadList :: ReadS [BoundExpr]
readsPrec :: Int -> ReadS BoundExpr
$creadsPrec :: Int -> ReadS BoundExpr
Read)