Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module has common SQL functions and operators which are supported in the most SQL databases
Synopsis
- like :: (SqlDb db, ExpressionOf db r a a', IsString a') => a -> String -> Cond db r
- notLike :: (SqlDb db, ExpressionOf db r a a', IsString a') => a -> String -> Cond db r
- in_ :: (SqlDb db, Expression db r a, Expression db r b, PrimitivePersistField b, Unifiable a b) => a -> [b] -> Cond db r
- notIn_ :: (SqlDb db, Expression db r a, Expression db r b, PrimitivePersistField b, Unifiable a b) => a -> [b] -> Cond db r
- lower :: (SqlDb db, ExpressionOf db r a a', IsString a') => a -> Expr db r a'
- upper :: (SqlDb db, ExpressionOf db r a a', IsString a') => a -> Expr db r a'
- case_ :: (SqlDb db, ExpressionOf db r a a', ExpressionOf db r b a') => [(Cond db r, a)] -> b -> Expr db r a'
- class (DbDescriptor db, QueryRaw db ~ Snippet db) => SqlDb db where
- append :: (ExpressionOf db r a String, ExpressionOf db r b String) => a -> b -> Expr db r String
- signum' :: (ExpressionOf db r x a, Num a) => x -> Expr db r a
- quotRem' :: (ExpressionOf db r x a, ExpressionOf db r y a, Integral a) => x -> y -> (Expr db r a, Expr db r a)
- equalsOperator :: RenderS db r -> RenderS db r -> RenderS db r
- notEqualsOperator :: RenderS db r -> RenderS db r -> RenderS db r
- cot :: (FloatingSqlDb db, ExpressionOf db r a a', Floating a') => a -> Expr db r a'
- atan2 :: RealFloat a => a -> a -> a
- radians :: (FloatingSqlDb db, ExpressionOf db r a a', Floating a') => a -> Expr db r a'
- degrees :: (FloatingSqlDb db, ExpressionOf db r a a', Floating a') => a -> Expr db r a'
Documentation
in_ :: (SqlDb db, Expression db r a, Expression db r b, PrimitivePersistField b, Unifiable a b) => a -> [b] -> Cond db r Source #
notIn_ :: (SqlDb db, Expression db r a, Expression db r b, PrimitivePersistField b, Unifiable a b) => a -> [b] -> Cond db r Source #
:: (SqlDb db, ExpressionOf db r a a', ExpressionOf db r b a') | |
=> [(Cond db r, a)] | Conditions |
-> b | It is returned when none of conditions is true |
-> Expr db r a' |
class (DbDescriptor db, QueryRaw db ~ Snippet db) => SqlDb db where Source #
This class distinguishes databases which support SQL-specific expressions. It contains ad hoc members for features whose syntax differs across the databases.
append :: (ExpressionOf db r a String, ExpressionOf db r b String) => a -> b -> Expr db r String Source #
signum' :: (ExpressionOf db r x a, Num a) => x -> Expr db r a Source #
quotRem' :: (ExpressionOf db r x a, ExpressionOf db r y a, Integral a) => x -> y -> (Expr db r a, Expr db r a) Source #
equalsOperator :: RenderS db r -> RenderS db r -> RenderS db r Source #
notEqualsOperator :: RenderS db r -> RenderS db r -> RenderS db r Source #
cot :: (FloatingSqlDb db, ExpressionOf db r a a', Floating a') => a -> Expr db r a' Source #
atan2 :: RealFloat a => a -> a -> a #
a version of arctangent taking two real floating-point arguments.
For real floating x
and y
,
computes the angle
(from the positive x-axis) of the vector from the origin to the
point atan2
y x(x,y)
.
returns a value in the range [atan2
y x-pi
,
pi
]. It follows the Common Lisp semantics for the origin when
signed zeroes are supported.
, with atan2
y 1y
in a type
that is RealFloat
, should return the same value as
.
A default definition of atan
yatan2
is provided, but implementors
can provide a more accurate implementation.
radians :: (FloatingSqlDb db, ExpressionOf db r a a', Floating a') => a -> Expr db r a' Source #
degrees :: (FloatingSqlDb db, ExpressionOf db r a a', Floating a') => a -> Expr db r a' Source #
Orphan instances
(SqlDb db, PersistField a, Enum a) => Enum (Expr db r a) Source # | |
succ :: Expr db r a -> Expr db r a # pred :: Expr db r a -> Expr db r a # toEnum :: Int -> Expr db r a # fromEnum :: Expr db r a -> Int # enumFrom :: Expr db r a -> [Expr db r a] # enumFromThen :: Expr db r a -> Expr db r a -> [Expr db r a] # enumFromTo :: Expr db r a -> Expr db r a -> [Expr db r a] # enumFromThenTo :: Expr db r a -> Expr db r a -> Expr db r a -> [Expr db r a] # | |
(FloatingSqlDb db, PersistField a, Floating a) => Floating (Expr db r a) Source # | |
exp :: Expr db r a -> Expr db r a # log :: Expr db r a -> Expr db r a # sqrt :: Expr db r a -> Expr db r a # (**) :: Expr db r a -> Expr db r a -> Expr db r a # logBase :: Expr db r a -> Expr db r a -> Expr db r a # sin :: Expr db r a -> Expr db r a # cos :: Expr db r a -> Expr db r a # tan :: Expr db r a -> Expr db r a # asin :: Expr db r a -> Expr db r a # acos :: Expr db r a -> Expr db r a # atan :: Expr db r a -> Expr db r a # sinh :: Expr db r a -> Expr db r a # cosh :: Expr db r a -> Expr db r a # tanh :: Expr db r a -> Expr db r a # asinh :: Expr db r a -> Expr db r a # acosh :: Expr db r a -> Expr db r a # atanh :: Expr db r a -> Expr db r a # log1p :: Expr db r a -> Expr db r a # expm1 :: Expr db r a -> Expr db r a # | |
(SqlDb db, PersistField a, Fractional a) => Fractional (Expr db r a) Source # | |
(SqlDb db, PurePersistField a, Integral a) => Integral (Expr db r a) Source # | |
quot :: Expr db r a -> Expr db r a -> Expr db r a # rem :: Expr db r a -> Expr db r a -> Expr db r a # div :: Expr db r a -> Expr db r a -> Expr db r a # mod :: Expr db r a -> Expr db r a -> Expr db r a # quotRem :: Expr db r a -> Expr db r a -> (Expr db r a, Expr db r a) # divMod :: Expr db r a -> Expr db r a -> (Expr db r a, Expr db r a) # | |
(SqlDb db, PersistField a, Num a) => Num (Expr db r a) Source # | |
(+) :: Expr db r a -> Expr db r a -> Expr db r a # (-) :: Expr db r a -> Expr db r a -> Expr db r a # (*) :: Expr db r a -> Expr db r a -> Expr db r a # negate :: Expr db r a -> Expr db r a # abs :: Expr db r a -> Expr db r a # signum :: Expr db r a -> Expr db r a # fromInteger :: Integer -> Expr db r a # | |
(SqlDb db, PersistField a, Ord a) => Ord (Expr db r a) Source # | |
(SqlDb db, PersistField a, Real a) => Real (Expr db r a) Source # | |
toRational :: Expr db r a -> Rational # |