Copyright | (c) Eitan Chatav 2019 |
---|---|
Maintainer | eitan@morphism.tech |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Squeal expressions are the atoms used to build statements.
Synopsis
- newtype Expression (outer :: FromType) (commons :: FromType) (grp :: Grouping) (schemas :: SchemasType) (params :: [NullityType]) (from :: FromType) (ty :: NullityType) = UnsafeExpression {}
- type Expr x = forall outer commons grp schemas params from. Expression outer commons grp schemas params from x
- type (:-->) x y = forall outer commons grp schemas params from. Expression outer commons grp schemas params from x -> Expression outer commons grp schemas params from y
- unsafeFunction :: ByteString -> x :--> y
- unsafeUnaryOpL :: ByteString -> x :--> y
- unsafeUnaryOpR :: ByteString -> x :--> y
- type Operator x1 x2 y = forall outer commons grp schemas params from. Expression outer commons grp schemas params from x1 -> Expression outer commons grp schemas params from x2 -> Expression outer commons grp schemas params from y
- unsafeBinaryOp :: ByteString -> Operator ty0 ty1 ty2
- type FunctionVar x0 x1 y = forall outer commons grp schemas params from. [Expression outer commons grp schemas params from x0] -> Expression outer commons grp schemas params from x1 -> Expression outer commons grp schemas params from y
- unsafeFunctionVar :: ByteString -> FunctionVar x0 x1 y
- type FunctionN xs y = forall outer commons grp schemas params from. NP (Expression outer commons grp schemas params from) xs -> Expression outer commons grp schemas params from y
- unsafeFunctionN :: SListI xs => ByteString -> FunctionN xs y
- class PGSubset container where
- (&) :: a -> (a -> b) -> b
- newtype K a (b :: k) :: forall k. Type -> k -> Type = K a
- unK :: K a b -> a
Expression
newtype Expression (outer :: FromType) (commons :: FromType) (grp :: Grouping) (schemas :: SchemasType) (params :: [NullityType]) (from :: FromType) (ty :: NullityType) Source #
Expression
s are used in a variety of contexts,
such as in the target List
of the
select
command,
as new column values in insertRow
or
update
,
or in search Condition
s in a number of commands.
The expression syntax allows the calculation of values from primitive expression using arithmetic, logical, and other operations.
The type parameters of Expression
are
outer ::
FromType
, thefrom
clauses of any outer queries in which theExpression
is a correlated subquery expression;commons ::
FromType
, theCommonTableExpression
s that are in scope for theExpression
;grp ::
Grouping
, theGrouping
of thefrom
clause which may limit which columns may be referenced by alias;schemas ::
SchemasType
, the schemas of your database that are in scope for theExpression
;from ::
FromType
, thefrom
clause which theExpression
may use to reference columns by alias;ty ::
NullityType
, the type of theExpression
.
Instances
(Has tab (Join outer from) row, Has col row ty, GroupedBy tab col bys, columns ~ ((col ::: ty) ': ([] :: [(Symbol, NullityType)]))) => IsQualified tab col (NP (Aliased (Expression outer commons (Grouped bys) schemas params from)) columns) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has tab (Join outer from) row, Has col row ty, GroupedBy tab col bys, column ~ (col ::: ty)) => IsQualified tab col (Aliased (Expression outer commons (Grouped bys) schemas params from) column) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has tab (Join outer from) row, Has col row ty, GroupedBy tab col bys, tys ~ (ty ': ([] :: [NullityType]))) => IsQualified tab col (NP (Expression outer commons (Grouped bys) schemas params from) tys) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has tab (Join outer from) row, Has col row ty, columns ~ ((col ::: ty) ': ([] :: [(Symbol, NullityType)]))) => IsQualified tab col (NP (Aliased (Expression outer commons Ungrouped schemas params from)) columns) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has tab (Join outer from) row, Has col row ty, column ~ (col ::: ty)) => IsQualified tab col (Aliased (Expression outer commons Ungrouped schemas params from) column) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has tab (Join outer from) row, Has col row ty, tys ~ (ty ': ([] :: [NullityType]))) => IsQualified tab col (NP (Expression outer commons Ungrouped schemas params from) tys) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has tab (Join outer from) row, Has col row ty, GroupedBy tab col bys) => IsQualified tab col (Expression outer commons (Grouped bys) schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(Has tab (Join outer from) row, Has col row ty) => IsQualified tab col (Expression outer commons Ungrouped schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
Aggregate (Distinction (Expression outer commons Ungrouped schemas params from)) (Distinction (NP (Expression outer commons Ungrouped schemas params from)) :: [NullityType] -> Type) (Expression outer commons (Grouped bys) schemas params from) Source # | |
Defined in Squeal.PostgreSQL.Expression.Aggregate countStar :: Expression outer commons (Grouped bys) schemas params from (NotNull PGint8) Source # count :: Distinction (Expression outer commons Ungrouped schemas params from) ty -> Expression outer commons (Grouped bys) schemas params from (NotNull PGint8) Source # sum_ :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null (PGSum ty)) Source # arrayAgg :: Distinction (Expression outer commons Ungrouped schemas params from) ty -> Expression outer commons (Grouped bys) schemas params from (Null (PGvararray ty)) Source # jsonAgg :: Distinction (Expression outer commons Ungrouped schemas params from) ty -> Expression outer commons (Grouped bys) schemas params from (Null PGjson) Source # jsonbAgg :: Distinction (Expression outer commons Ungrouped schemas params from) ty -> Expression outer commons (Grouped bys) schemas params from (Null PGjsonb) Source # bitAnd :: In int PGIntegral => Distinction (Expression outer commons Ungrouped schemas params from) (null int) -> Expression outer commons (Grouped bys) schemas params from (Null int) Source # bitOr :: In int PGIntegral => Distinction (Expression outer commons Ungrouped schemas params from) (null int) -> Expression outer commons (Grouped bys) schemas params from (Null int) Source # boolAnd :: Distinction (Expression outer commons Ungrouped schemas params from) (null PGbool) -> Expression outer commons (Grouped bys) schemas params from (Null PGbool) Source # boolOr :: Distinction (Expression outer commons Ungrouped schemas params from) (null PGbool) -> Expression outer commons (Grouped bys) schemas params from (Null PGbool) Source # every :: Distinction (Expression outer commons Ungrouped schemas params from) (null PGbool) -> Expression outer commons (Grouped bys) schemas params from (Null PGbool) Source # max_ :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null ty) Source # min_ :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null ty) Source # avg :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null (PGAvg ty)) Source # corr :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # covarPop :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # covarSamp :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # regrAvgX :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # regrAvgY :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # regrCount :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGint8) Source # regrIntercept :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # regrR2 :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # regrSlope :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # regrSxx :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # regrSxy :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # regrSyy :: Distinction (NP (Expression outer commons Ungrouped schemas params from)) (null PGfloat8 ': (null PGfloat8 ': [])) -> Expression outer commons (Grouped bys) schemas params from (Null PGfloat8) Source # stddev :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null (PGAvg ty)) Source # stddevPop :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null (PGAvg ty)) Source # stddevSamp :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null (PGAvg ty)) Source # variance :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null (PGAvg ty)) Source # varPop :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null (PGAvg ty)) Source # varSamp :: Distinction (Expression outer commons Ungrouped schemas params from) (null ty) -> Expression outer commons (Grouped bys) schemas params from (Null (PGAvg ty)) Source # | |
(HasUnique tab (Join outer from) row, Has col row ty, GroupedBy tab col bys, columns ~ ((col ::: ty) ': ([] :: [(Symbol, NullityType)]))) => IsLabel col (NP (Aliased (Expression outer commons (Grouped bys) schemas params from)) columns) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(HasUnique tab (Join outer from) row, Has col row ty, GroupedBy tab col bys, column ~ (col ::: ty)) => IsLabel col (Aliased (Expression outer commons (Grouped bys) schemas params from) column) Source # | |
Defined in Squeal.PostgreSQL.Expression fromLabel :: Aliased (Expression outer commons (Grouped bys) schemas params from) column # | |
(HasUnique tab (Join outer from) row, Has col row ty, GroupedBy tab col bys, tys ~ (ty ': ([] :: [NullityType]))) => IsLabel col (NP (Expression outer commons (Grouped bys) schemas params from) tys) Source # | |
Defined in Squeal.PostgreSQL.Expression fromLabel :: NP (Expression outer commons (Grouped bys) schemas params from) tys # | |
(HasUnique tab (Join outer from) row, Has col row ty, columns ~ ((col ::: ty) ': ([] :: [(Symbol, NullityType)]))) => IsLabel col (NP (Aliased (Expression outer commons Ungrouped schemas params from)) columns) Source # | |
Defined in Squeal.PostgreSQL.Expression | |
(HasUnique tab (Join outer from) row, Has col row ty, column ~ (col ::: ty)) => IsLabel col (Aliased (Expression outer commons Ungrouped schemas params from) column) Source # | |
Defined in Squeal.PostgreSQL.Expression fromLabel :: Aliased (Expression outer commons Ungrouped schemas params from) column # | |
(HasUnique tab (Join outer from) row, Has col row ty, tys ~ (ty ': ([] :: [NullityType]))) => IsLabel col (NP (Expression outer commons Ungrouped schemas params from) tys) Source # | |
Defined in Squeal.PostgreSQL.Expression fromLabel :: NP (Expression outer commons Ungrouped schemas params from) tys # | |
Aggregate (Expression outer commons grp schemas params from) (NP (Expression outer commons grp schemas params from) :: [NullityType] -> Type) (WindowFunction outer commons grp schemas params from) Source # | |
Defined in Squeal.PostgreSQL.Expression.Window countStar :: WindowFunction outer commons grp schemas params from (NotNull PGint8) Source # count :: Expression outer commons grp schemas params from ty -> WindowFunction outer commons grp schemas params from (NotNull PGint8) Source # sum_ :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null (PGSum ty)) Source # arrayAgg :: Expression outer commons grp schemas params from ty -> WindowFunction outer commons grp schemas params from (Null (PGvararray ty)) Source # jsonAgg :: Expression outer commons grp schemas params from ty -> WindowFunction outer commons grp schemas params from (Null PGjson) Source # jsonbAgg :: Expression outer commons grp schemas params from ty -> WindowFunction outer commons grp schemas params from (Null PGjsonb) Source # bitAnd :: In int PGIntegral => Expression outer commons grp schemas params from (null int) -> WindowFunction outer commons grp schemas params from (Null int) Source # bitOr :: In int PGIntegral => Expression outer commons grp schemas params from (null int) -> WindowFunction outer commons grp schemas params from (Null int) Source # boolAnd :: Expression outer commons grp schemas params from (null PGbool) -> WindowFunction outer commons grp schemas params from (Null PGbool) Source # boolOr :: Expression outer commons grp schemas params from (null PGbool) -> WindowFunction outer commons grp schemas params from (Null PGbool) Source # every :: Expression outer commons grp schemas params from (null PGbool) -> WindowFunction outer commons grp schemas params from (Null PGbool) Source # max_ :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null ty) Source # min_ :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null ty) Source # avg :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null (PGAvg ty)) Source # corr :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # covarPop :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # covarSamp :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # regrAvgX :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # regrAvgY :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # regrCount :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGint8) Source # regrIntercept :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # regrR2 :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # regrSlope :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # regrSxx :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # regrSxy :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # regrSyy :: NP (Expression outer commons grp schemas params from) (null PGfloat8 ': (null PGfloat8 ': [])) -> WindowFunction outer commons grp schemas params from (Null PGfloat8) Source # stddev :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null (PGAvg ty)) Source # stddevPop :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null (PGAvg ty)) Source # stddevSamp :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null (PGAvg ty)) Source # variance :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null (PGAvg ty)) Source # varPop :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null (PGAvg ty)) Source # varSamp :: Expression outer commons grp schemas params from (null ty) -> WindowFunction outer commons grp schemas params from (Null (PGAvg ty)) Source # | |
(HasUnique tab (Join outer from) row, Has col row ty, GroupedBy tab col bys) => IsLabel col (Expression outer commons (Grouped bys) schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression fromLabel :: Expression outer commons (Grouped bys) schemas params from ty # | |
(HasUnique tab (Join outer from) row, Has col row ty) => IsLabel col (Expression outer commons Ungrouped schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression fromLabel :: Expression outer commons Ungrouped schemas params from ty # | |
(KnownSymbol label, In label labels) => IsPGlabel label (Expression outer commons grp schemas params from (null (PGenum labels))) Source # | |
Defined in Squeal.PostgreSQL.Expression label :: Expression outer commons grp schemas params from (null (PGenum labels)) Source # | |
(KnownSymbol col, row ~ ((col ::: ty) ': ([] :: [(Symbol, NullityType)]))) => Aliasable col (Expression outer commons grp schemas params from ty) (Selection outer commons grp schemas params from row) Source # | |
Defined in Squeal.PostgreSQL.Query | |
NFData (Distinction (Expression outer commons grp schemas params from) ty) Source # | |
Defined in Squeal.PostgreSQL.Expression.Aggregate rnf :: Distinction (Expression outer commons grp schemas params from) ty -> () # | |
SListI tys => RenderSQL (Distinction (NP (Expression outer commons grp schemas params from)) tys) Source # | |
Defined in Squeal.PostgreSQL.Expression.Aggregate renderSQL :: Distinction (NP (Expression outer commons grp schemas params from)) tys -> ByteString Source # | |
RenderSQL (Distinction (Expression outer commons grp schemas params from) ty) Source # | |
Defined in Squeal.PostgreSQL.Expression.Aggregate renderSQL :: Distinction (Expression outer commons grp schemas params from) ty -> ByteString Source # | |
Eq (Expression outer commons grp schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression (==) :: Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty -> Bool # (/=) :: Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty -> Bool # | |
(In ty PGNum, In ty PGFloating) => Floating (Expression outer commons grp schemas params from (null ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression pi :: Expression outer commons grp schemas params from (null ty) # exp :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # log :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # sqrt :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # (**) :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # logBase :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # sin :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # cos :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # tan :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # asin :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # acos :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # atan :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # sinh :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # cosh :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # tanh :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # asinh :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # acosh :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # atanh :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # log1p :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # expm1 :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # log1pexp :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # log1mexp :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # | |
(In ty PGNum, In ty PGFloating) => Fractional (Expression outer commons grp schemas params from (null ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression (/) :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # recip :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # fromRational :: Rational -> Expression outer commons grp schemas params from (null ty) # | |
In ty PGNum => Num (Expression outer commons grp schemas params from (null ty)) Source # | |
Defined in Squeal.PostgreSQL.Expression (+) :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # (-) :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # (*) :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # negate :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # abs :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # signum :: Expression outer commons grp schemas params from (null ty) -> Expression outer commons grp schemas params from (null ty) # fromInteger :: Integer -> Expression outer commons grp schemas params from (null ty) # | |
Ord (Expression outer commons grp schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression compare :: Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty -> Ordering # (<) :: Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty -> Bool # (<=) :: Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty -> Bool # (>) :: Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty -> Bool # (>=) :: Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty -> Bool # max :: Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty # min :: Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty -> Expression outer commons grp schemas params from ty # | |
Show (Expression outer commons grp schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression showsPrec :: Int -> Expression outer commons grp schemas params from ty -> ShowS # show :: Expression outer commons grp schemas params from ty -> String # showList :: [Expression outer commons grp schemas params from ty] -> ShowS # | |
IsString (Expression outer commons grp schemas params from (null PGtsquery)) Source # | |
Defined in Squeal.PostgreSQL.Expression fromString :: String -> Expression outer commons grp schemas params from (null PGtsquery) # | |
IsString (Expression outer commons grp schemas params from (null PGtsvector)) Source # | |
Defined in Squeal.PostgreSQL.Expression fromString :: String -> Expression outer commons grp schemas params from (null PGtsvector) # | |
IsString (Expression outer commons grp schemas params from (null PGtext)) Source # | |
Defined in Squeal.PostgreSQL.Expression fromString :: String -> Expression outer commons grp schemas params from (null PGtext) # | |
Generic (Expression outer commons grp schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression type Rep (Expression outer commons grp schemas params from ty) :: Type -> Type # from :: Expression outer commons grp schemas params from ty -> Rep (Expression outer commons grp schemas params from ty) x # to :: Rep (Expression outer commons grp schemas params from ty) x -> Expression outer commons grp schemas params from ty # | |
Semigroup (Expression outer commons grp schemas params from (null PGtsvector)) Source # | |
Defined in Squeal.PostgreSQL.Expression (<>) :: Expression outer commons grp schemas params from (null PGtsvector) -> Expression outer commons grp schemas params from (null PGtsvector) -> Expression outer commons grp schemas params from (null PGtsvector) # sconcat :: NonEmpty (Expression outer commons grp schemas params from (null PGtsvector)) -> Expression outer commons grp schemas params from (null PGtsvector) # stimes :: Integral b => b -> Expression outer commons grp schemas params from (null PGtsvector) -> Expression outer commons grp schemas params from (null PGtsvector) # | |
Semigroup (Expression outer commons grp schemas params from (null PGtext)) Source # | |
Defined in Squeal.PostgreSQL.Expression (<>) :: Expression outer commons grp schemas params from (null PGtext) -> Expression outer commons grp schemas params from (null PGtext) -> Expression outer commons grp schemas params from (null PGtext) # sconcat :: NonEmpty (Expression outer commons grp schemas params from (null PGtext)) -> Expression outer commons grp schemas params from (null PGtext) # stimes :: Integral b => b -> Expression outer commons grp schemas params from (null PGtext) -> Expression outer commons grp schemas params from (null PGtext) # | |
Semigroup (Expression outer commons grp schemas params from (null PGjsonb)) Source # | |
Defined in Squeal.PostgreSQL.Expression (<>) :: Expression outer commons grp schemas params from (null PGjsonb) -> Expression outer commons grp schemas params from (null PGjsonb) -> Expression outer commons grp schemas params from (null PGjsonb) # sconcat :: NonEmpty (Expression outer commons grp schemas params from (null PGjsonb)) -> Expression outer commons grp schemas params from (null PGjsonb) # stimes :: Integral b => b -> Expression outer commons grp schemas params from (null PGjsonb) -> Expression outer commons grp schemas params from (null PGjsonb) # | |
Semigroup (Expression outer commons grp schemas params from (null (PGvararray ty))) Source # | |
Defined in Squeal.PostgreSQL.Expression (<>) :: Expression outer commons grp schemas params from (null (PGvararray ty)) -> Expression outer commons grp schemas params from (null (PGvararray ty)) -> Expression outer commons grp schemas params from (null (PGvararray ty)) # sconcat :: NonEmpty (Expression outer commons grp schemas params from (null (PGvararray ty))) -> Expression outer commons grp schemas params from (null (PGvararray ty)) # stimes :: Integral b => b -> Expression outer commons grp schemas params from (null (PGvararray ty)) -> Expression outer commons grp schemas params from (null (PGvararray ty)) # | |
Monoid (Expression outer commons grp schemas params from (null PGtsvector)) Source # | |
Defined in Squeal.PostgreSQL.Expression mempty :: Expression outer commons grp schemas params from (null PGtsvector) # mappend :: Expression outer commons grp schemas params from (null PGtsvector) -> Expression outer commons grp schemas params from (null PGtsvector) -> Expression outer commons grp schemas params from (null PGtsvector) # mconcat :: [Expression outer commons grp schemas params from (null PGtsvector)] -> Expression outer commons grp schemas params from (null PGtsvector) # | |
Monoid (Expression outer commons grp schemas params from (null PGtext)) Source # | |
Defined in Squeal.PostgreSQL.Expression mempty :: Expression outer commons grp schemas params from (null PGtext) # mappend :: Expression outer commons grp schemas params from (null PGtext) -> Expression outer commons grp schemas params from (null PGtext) -> Expression outer commons grp schemas params from (null PGtext) # mconcat :: [Expression outer commons grp schemas params from (null PGtext)] -> Expression outer commons grp schemas params from (null PGtext) # | |
NFData (Expression outer commons grp schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression rnf :: Expression outer commons grp schemas params from ty -> () # | |
RenderSQL (Expression outer commons grp schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression renderSQL :: Expression outer commons grp schemas params from ty -> ByteString Source # | |
type Rep (Expression outer commons grp schemas params from ty) Source # | |
Defined in Squeal.PostgreSQL.Expression type Rep (Expression outer commons grp schemas params from ty) = D1 (MetaData "Expression" "Squeal.PostgreSQL.Expression" "squeal-postgresql-0.5.2.0-4fAomBtpMjd6mRwLthA4w2" True) (C1 (MetaCons "UnsafeExpression" PrefixI True) (S1 (MetaSel (Just "renderExpression") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString))) |
= Expression outer commons grp schemas params from x | cannot reference aliases |
An Expr
is a closed Expression
.
It is a FRankNType
but don't be scared.
Think of it as an expression which sees no
namespaces, so you can't use parameters
or alias references. It can be used as
a simple piece of more complex Expression
s.
= Expression outer commons grp schemas params from x | input |
-> Expression outer commons grp schemas params from y | output |
unsafeFunction :: ByteString -> x :--> y Source #
>>>
printSQL $ unsafeFunction "f" true
f(TRUE)
unsafeUnaryOpL :: ByteString -> x :--> y Source #
>>>
printSQL $ unsafeUnaryOpL "NOT" true
(NOT TRUE)
unsafeUnaryOpR :: ByteString -> x :--> y Source #
>>>
printSQL $ true & unsafeUnaryOpR "IS NOT TRUE"
(TRUE IS NOT TRUE)
type Operator x1 x2 y Source #
= Expression outer commons grp schemas params from x1 | left input |
-> Expression outer commons grp schemas params from x2 | right input |
-> Expression outer commons grp schemas params from y | output |
A RankNType
for binary operators.
unsafeBinaryOp :: ByteString -> Operator ty0 ty1 ty2 Source #
>>>
printSQL $ unsafeBinaryOp "OR" true false
(TRUE OR FALSE)
type FunctionVar x0 x1 y Source #
= [Expression outer commons grp schemas params from x0] | inputs |
-> Expression outer commons grp schemas params from x1 | must have at least 1 input |
-> Expression outer commons grp schemas params from y | output |
A RankNType
for functions with a variable-length list of
homogeneous arguments and at least 1 more argument.
unsafeFunctionVar :: ByteString -> FunctionVar x0 x1 y Source #
>>>
printSQL (unsafeFunctionVar "greatest" [true, null_] false)
greatest(TRUE, NULL, FALSE)
= NP (Expression outer commons grp schemas params from) xs | inputs |
-> Expression outer commons grp schemas params from y | output |
A RankNType
for functions with a fixed-length list of heterogeneous arguments.
Use the *:
operator to end your argument lists, like so.
>>>
printSQL (unsafeFunctionN "fun" (true :* false :* localTime *: true))
fun(TRUE, FALSE, LOCALTIME, TRUE)
unsafeFunctionN :: SListI xs => ByteString -> FunctionN xs y Source #
>>>
printSQL $ unsafeFunctionN "f" (currentTime :* localTimestamp :* false *: literal 'a')
f(CURRENT_TIME, LOCALTIMESTAMP, FALSE, E'a')
class PGSubset container where Source #
Contained by operators
Nothing
(@>) :: Operator (null0 container) (null1 container) (Null PGbool) Source #
(<@) :: Operator (null0 container) (null1 container) (Null PGbool) Source #
Instances
PGSubset PGjsonb Source # | |
PGSubset PGtsquery Source # | |
PGSubset (PGvararray ty :: PGType) Source # | |
Defined in Squeal.PostgreSQL.Expression (@>) :: Operator (null0 (PGvararray ty)) (null1 (PGvararray ty)) (Null PGbool) Source # (<@) :: Operator (null0 (PGvararray ty)) (null1 (PGvararray ty)) (Null PGbool) Source # |
Re-export
newtype K a (b :: k) :: forall k. Type -> k -> Type #
The constant type functor.
Like Constant
, but kind-polymorphic
in its second argument and with a shorter name.
K a |
Instances
Eq2 (K :: Type -> Type -> Type) | Since: sop-core-0.2.4.0 |
Ord2 (K :: Type -> Type -> Type) | Since: sop-core-0.2.4.0 |
Defined in Data.SOP.BasicFunctors | |
Read2 (K :: Type -> Type -> Type) | Since: sop-core-0.2.4.0 |
Defined in Data.SOP.BasicFunctors liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (K a b) # liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [K a b] # liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (K a b) # liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [K a b] # | |
Show2 (K :: Type -> Type -> Type) | Since: sop-core-0.2.4.0 |
NFData2 (K :: Type -> Type -> Type) | Since: sop-core-0.2.5.0 |
Defined in Data.SOP.BasicFunctors | |
Functor (K a :: Type -> Type) | |
Monoid a => Applicative (K a :: Type -> Type) | |
Foldable (K a :: Type -> Type) | |
Defined in Data.SOP.BasicFunctors fold :: Monoid m => K a m -> m # foldMap :: Monoid m => (a0 -> m) -> K a a0 -> m # foldr :: (a0 -> b -> b) -> b -> K a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> K a a0 -> b # foldl :: (b -> a0 -> b) -> b -> K a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> K a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> K a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> K a a0 -> a0 # elem :: Eq a0 => a0 -> K a a0 -> Bool # maximum :: Ord a0 => K a a0 -> a0 # minimum :: Ord a0 => K a a0 -> a0 # | |
Traversable (K a :: Type -> Type) | |
Eq a => Eq1 (K a :: Type -> Type) | Since: sop-core-0.2.4.0 |
Ord a => Ord1 (K a :: Type -> Type) | Since: sop-core-0.2.4.0 |
Defined in Data.SOP.BasicFunctors | |
Read a => Read1 (K a :: Type -> Type) | Since: sop-core-0.2.4.0 |
Defined in Data.SOP.BasicFunctors | |
Show a => Show1 (K a :: Type -> Type) | Since: sop-core-0.2.4.0 |
NFData a => NFData1 (K a :: Type -> Type) | Since: sop-core-0.2.5.0 |
Defined in Data.SOP.BasicFunctors | |
Eq a => Eq (K a b) | |
Ord a => Ord (K a b) | |
Read a => Read (K a b) | |
Show a => Show (K a b) | |
Generic (K a b) | |
Semigroup a => Semigroup (K a b) | Since: sop-core-0.4.0.0 |
Monoid a => Monoid (K a b) | Since: sop-core-0.4.0.0 |
NFData a => NFData (K a b) | Since: sop-core-0.2.5.0 |
Defined in Data.SOP.BasicFunctors | |
type Rep (K a b) | |
Defined in Data.SOP.BasicFunctors | |
type Code (K a b) | |
Defined in Generics.SOP.Instances | |
type DatatypeInfoOf (K a b) | |
Defined in Generics.SOP.Instances |